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:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user