nsCOMPtr<nsIContent> content; if (NS_SUCCEEDED(ChildAt(aIndex, *getter_AddRefs(content)))) { RemoveOption(content); }
WillRemoveOptions(this, aIndex); WillAddOptions(aKid, this, aIndex);
nsHTMLSelectElement::ReplaceChildAt(nsIContent* aKid, PRInt32 aIndex,                                    PRBool aNotify) {  nsCOMPtr<nsIContent> content;  if (NS_SUCCEEDED(ChildAt(aIndex, *getter_AddRefs(content)))) {    RemoveOption(content);  }  nsresult res = nsGenericHTMLContainerFormElement::ReplaceChildAt(aKid,                                                                   aIndex,                                                                   aNotify);  if (NS_SUCCEEDED(res)) {    AddOption(aKid);  }  return res;}