Bug 3285: Implement Item() method on Form Element content object.
This commit is contained in:
Родитель
5885978887
Коммит
c9f3e8764c
|
@ -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()
|
||||
|
|
Загрузка…
Ссылка в новой задаче