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

This commit is contained in:
pollmann%netscape.com 1999-08-20 23:15:40 +00:00
Родитель 5885978887
Коммит c9f3e8764c
2 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -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()