element->SetDocument(mDocument, PR_FALSE);
element->SetDocument(mDocument, PR_FALSE, PR_TRUE);
HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode){  nsresult  result = NS_OK;  nsIHTMLContent* parent = nsnull;    if(mCurrentContext!=nsnull) {    parent=mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;  }    if(parent!=nsnull) {    // Create content object    nsIHTMLContent* element = nsnull;    nsCOMPtr<nsINodeInfo> nodeInfo;    mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::link, nsnull, kNameSpaceID_HTML,                                  *getter_AddRefs(nodeInfo));    result = NS_CreateHTMLElement(&element, nodeInfo);    if (NS_SUCCEEDED(result)) {      PRInt32 id;      mDocument->GetAndIncrementContentID(&id);            element->SetContentID(id);      // Add in the attributes and add the style content object to the      // head container.          element->SetDocument(mDocument, PR_FALSE);      result = AddAttributes(aNode, element);      if (NS_FAILED(result)) {        NS_RELEASE(element);        return result;      }      parent->AppendChildTo(element, PR_FALSE);    }    else {      return result;    }        // XXX need prefs. check here.    if(!mInsideNoXXXTag) {      PRInt32   i;      PRInt32   count = aNode.GetAttributeCount();      nsAutoString href;      nsAutoString rel;       nsAutoString title;       nsAutoString type;       nsAutoString media;       for (i = 0; i < count; i++) {        const nsString& key = aNode.GetKeyAt(i);        if (key.EqualsIgnoreCase("href")) {          GetAttributeValueAt(aNode, i, href);          href.StripWhitespace();        }        else if (key.EqualsIgnoreCase("rel")) {          GetAttributeValueAt(aNode, i, rel);          rel.CompressWhitespace();        }        else if (key.EqualsIgnoreCase("title")) {          GetAttributeValueAt(aNode, i, title);          title.CompressWhitespace();        }        else if (key.EqualsIgnoreCase("type")) {          GetAttributeValueAt(aNode, i, type);          type.StripWhitespace();        }        else if (key.EqualsIgnoreCase("media")) {          GetAttributeValueAt(aNode, i, media);          media.ToLowerCase(); // HTML4.0 spec is inconsistent, make it case INSENSITIVE        }      }      if (0 < href.Length()) {        result = ProcessStyleLink(element, href, rel, title, type, media);      }    }    NS_RELEASE(element);  }  return result;}