if (mDirty && mSelect) { GetOptions();
if (!mOptions) { Init();
nsHTMLOptionCollection::NamedItem(const nsAReadableString& aName,                                  nsIDOMNode** aReturn){  if (mDirty && mSelect) {    GetOptions();  }  PRUint32 count = mElements.Count();  nsresult result = NS_OK;  *aReturn = nsnull;  for (PRUint32 i = 0; i < count && !*aReturn; i++) {    nsIDOMHTMLOptionElement *option;    option = (nsIDOMHTMLOptionElement*)mElements.ElementAt(i);    if (nsnull != option) {      nsCOMPtr<nsIContent> content(do_QueryInterface(option));      if (content) {        nsAutoString name;        // XXX Should it be an EqualsIgnoreCase?        if (((content->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::name,                               name) == NS_CONTENT_ATTR_HAS_VALUE) &&             (aName.Equals(name))) ||            ((content->GetAttr(kNameSpaceID_HTML, nsHTMLAtoms::id,                               name) == NS_CONTENT_ATTR_HAS_VALUE) &&             (aName.Equals(name)))) {          result = option->QueryInterface(NS_GET_IID(nsIDOMNode),                                          (void **)aReturn);        }      }    }  }    return result;}