NS_RELEASE(control);
nsForm::NamedItem(const nsString& aName, nsIDOMElement** aReturn){  // XXX For now we just search our element list. When forms become  // real content, we'll have to look at all our children, similar  // to the way HTMLDocuments do this.  PRInt32 i, count = GetFormControlCount();  nsresult result = NS_OK;  *aReturn = nsnull;  for (i = 0; i < count && *aReturn == nsnull; i++) {    nsIFormControl *control = (nsIFormControl *)GetFormControlAt(i);    if (nsnull != control) {      nsIContent *content;            result = control->QueryInterface(kIContentIID, (void **)&content);      if (NS_OK == result) {        nsAutoString name;        // XXX Should it be an EqualsIgnoreCase?        if (((content->GetAttribute("NAME", name) == eContentAttr_HasValue) &&             (aName.Equals(name))) ||            ((content->GetAttribute("ID", name) == eContentAttr_HasValue) &&             (aName.Equals(name)))) {          result = control->QueryInterface(kIDOMElementIID, (void **)aReturn);        }        NS_RELEASE(content);      }      NS_RELEASE(control);    }  }    return result;  }