nsresult result; nsIDOMNode* ret;  if (nsnull != aBefore) { result = mInner.AppendChild(aElement, &ret); NS_IF_RELEASE(ret); } else {   nsIDOMNode* parent;  result = aBefore->GetParentNode(&parent); if (NS_SUCCEEDED(result) && (nsnull != parent)) { result = parent->InsertBefore(aElement, aBefore, &ret); NS_IF_RELEASE(ret); NS_RELEASE(parent); }
nsCOMPtr<nsIDOMNode> added; if (!aBefore) { return AppendChild(aElement, getter_AddRefs(added));
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore){  nsresult result;  nsIDOMNode* ret;  if (nsnull != aBefore) {    result = mInner.AppendChild(aElement, &ret);    NS_IF_RELEASE(ret);  }  else {    // Just in case we're not the parent, get the parent of the reference    // element    nsIDOMNode* parent;        result = aBefore->GetParentNode(&parent);    if (NS_SUCCEEDED(result) && (nsnull != parent)) {      result = parent->InsertBefore(aElement, aBefore, &ret);      NS_IF_RELEASE(ret);      NS_RELEASE(parent);    }  }  return result;}