if (mOptions) { return mOptions->NamedItem(aName, aReturn);
PRUint32 count = mElements.Count(); nsresult result = NS_OK;  *aReturn = nsnull; for (PRUint32 i = 0; i < count && *aReturn == nsnull; i++) { nsIDOMHTMLOptionElement *option; option = (nsIDOMHTMLOptionElement*)mElements.ElementAt(i); if (nsnull != option) { nsIContent *content;  result = option->QueryInterface(kIContentIID, (void **)&content); if (NS_OK == result) { nsAutoString name;  if (((content->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::name, name) == NS_CONTENT_ATTR_HAS_VALUE) && (aName.Equals(name))) || ((content->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::id, name) == NS_CONTENT_ATTR_HAS_VALUE) && (aName.Equals(name)))) { result = option->QueryInterface(kIDOMNodeIID, (void **)aReturn); } NS_RELEASE(content); } }
nsHTMLSelectElement::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn){  if (!mOptions) {    Init();  }  if (mOptions) {    return mOptions->NamedItem(aName, aReturn);  }  return NS_ERROR_FAILURE;}