if (mArtifactsAtTopLevel) {
if (mNonOptionChildren) {
nsHTMLSelectElement::IsOptionDisabled(PRInt32 aIndex, PRBool* aIsDisabled){  *aIsDisabled = PR_FALSE;  nsCOMPtr<nsIDOMNode> optionNode;  Item(aIndex, getter_AddRefs(optionNode));  NS_ENSURE_TRUE(optionNode, NS_ERROR_FAILURE);  nsCOMPtr<nsIDOMHTMLOptionElement> option = do_QueryInterface(optionNode);  if (option) {    PRBool isDisabled;    option->GetDisabled(&isDisabled);    if (isDisabled) {      *aIsDisabled = PR_TRUE;      return NS_OK;    }  }  // Check for disabled optgroups  // If there are no artifacts, there are no optgroups  if (mArtifactsAtTopLevel) {    nsCOMPtr<nsIDOMNode> parent;    while (1) {      optionNode->GetParentNode(getter_AddRefs(parent));      // If we reached the top of the doc (scary), we're done      if (!parent) {        break;      }      // If we reached the select element, we're done      nsCOMPtr<nsIDOMHTMLSelectElement> selectElement =        do_QueryInterface(parent);      if (selectElement) {        break;      }      nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroupElement =        do_QueryInterface(parent);      if (optGroupElement) {        PRBool isDisabled;        optGroupElement->GetDisabled(&isDisabled);        if (isDisabled) {          *aIsDisabled = PR_TRUE;          return NS_OK;        }      } else {        // If you put something else between you and the optgroup, you're a        // moron and you deserve not to have optgroup disabling work.        break;      }      optionNode = parent;    }  }    return NS_OK;}