newCaption->QueryInterface(NS_GET_IID(nsIDOMHTMLElement), (void **)aValue);
CallQueryInterface(newCaption, aValue);
nsHTMLTableElement::CreateCaption(nsIDOMHTMLElement** aValue){  *aValue = nsnull;  nsresult rv = NS_OK;  nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption;  GetCaption(getter_AddRefs(caption));  if (caption) { // return the existing thead    caption->QueryInterface(NS_GET_IID(nsIDOMHTMLElement), (void **)aValue);    NS_ASSERTION(nsnull!=*aValue, "caption must be a DOMHTMLElement");  }  else  { // create a new head rowgroup    nsCOMPtr<nsIHTMLContent> newCaption;    nsCOMPtr<nsINodeInfo> nodeInfo;    mNodeInfo->NameChanged(nsHTMLAtoms::caption, *getter_AddRefs(nodeInfo));    rv = NS_NewHTMLTableCaptionElement(getter_AddRefs(newCaption),nodeInfo);    if (NS_SUCCEEDED(rv) && newCaption) {      rv = AppendChildTo(newCaption, PR_TRUE, PR_FALSE);      newCaption->QueryInterface(NS_GET_IID(nsIDOMHTMLElement),                                 (void **)aValue);    }  }  return NS_OK;}