Bug 3285: Implement Item() method on Form Element content object.

git-svn-id: svn://10.0.0.236/trunk@43889 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pollmann%netscape.com
1999-08-20 23:15:40 +00:00
parent b3b2f14e83
commit 02711c3435
2 changed files with 38 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ public:
// nsIDOMNSHTMLFormElement
NS_IMETHOD GetEncoding(nsString& aEncoding);
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn);
// nsIScriptObjectOwner
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
@@ -602,6 +603,24 @@ nsHTMLFormElement::Finalize(JSContext *aContext)
mInner.Finalize(aContext);
}
NS_IMETHODIMP
nsHTMLFormElement::Item(PRUint32 aIndex, nsIDOMElement** aReturn)
{
if (mControls) {
nsIDOMNode *node;
nsresult result = mControls->Item(aIndex, &node);
if ((NS_OK == result) && (nsnull != node)) {
result = node->QueryInterface(kIDOMElementIID, (void **)aReturn);
NS_RELEASE(node);
}
else {
*aReturn = nsnull;
}
return result;
}
return NS_ERROR_FAILURE;
}
// nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere
nsFormControlList::nsFormControlList()

View File

@@ -92,6 +92,7 @@ public:
// nsIDOMNSHTMLFormElement
NS_IMETHOD GetEncoding(nsString& aEncoding);
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMElement** aReturn);
// nsIScriptObjectOwner
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
@@ -602,6 +603,24 @@ nsHTMLFormElement::Finalize(JSContext *aContext)
mInner.Finalize(aContext);
}
NS_IMETHODIMP
nsHTMLFormElement::Item(PRUint32 aIndex, nsIDOMElement** aReturn)
{
if (mControls) {
nsIDOMNode *node;
nsresult result = mControls->Item(aIndex, &node);
if ((NS_OK == result) && (nsnull != node)) {
result = node->QueryInterface(kIDOMElementIID, (void **)aReturn);
NS_RELEASE(node);
}
else {
*aReturn = nsnull;
}
return result;
}
return NS_ERROR_FAILURE;
}
// nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere
nsFormControlList::nsFormControlList()