rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nsHTMLAtoms::thead);
nsCOMPtr<nsINodeInfo> nodeInfo; mInner.mNodeInfo->NameChanged(nsHTMLAtoms::thead, *getter_AddRefs(nodeInfo));  rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nodeInfo);
nsHTMLTableElement::CreateTHead(nsIDOMHTMLElement** aValue){  *aValue = nsnull;  nsresult rv = NS_OK;  nsCOMPtr<nsIDOMHTMLTableSectionElement> head;  GetTHead(getter_AddRefs(head));  if (head)  { // return the existing thead    head->QueryInterface(kIDOMHTMLElementIID, (void **)aValue);  // caller's addref    NS_ASSERTION(nsnull!=*aValue, "head must be a DOMHTMLElement");  }  else  { // create a new head rowgroup    nsCOMPtr<nsIHTMLContent> newHead;    rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nsHTMLAtoms::thead);    if (NS_SUCCEEDED(rv) && newHead)    {      nsCOMPtr<nsIDOMNode> child;      rv = mInner.GetFirstChild(getter_AddRefs(child));      if (NS_FAILED(rv)) {        return rv;      }           newHead->QueryInterface(kIDOMHTMLElementIID, (void **)aValue); // caller's addref      nsCOMPtr<nsIDOMNode> resultChild;      rv = mInner.InsertBefore(*aValue, child, getter_AddRefs(resultChild));    }  }  return NS_OK;}