nsCOMPtr<nsIDOMSelection> selection;
nsCOMPtr<nsISelection> selection;
nsHTMLEditor::DeleteSelectionAndCreateNode(const nsString& aTag,                                           nsIDOMNode ** aNewNode){  nsCOMPtr<nsIDOMNode> parentSelectedNode;  PRInt32 offsetOfNewNode;  nsresult result = DeleteSelectionAndPrepareToCreateNode(parentSelectedNode,                                                          offsetOfNewNode);  if (!NS_SUCCEEDED(result))    return result;  nsCOMPtr<nsIDOMNode> newNode;  result = CreateNode(aTag, parentSelectedNode, offsetOfNewNode,                      getter_AddRefs(newNode));  // XXX: ERROR_HANDLING  check result, and make sure aNewNode is set correctly in success/failure cases  *aNewNode = newNode;  NS_IF_ADDREF(*aNewNode);  // we want the selection to be just after the new node  nsCOMPtr<nsIDOMSelection> selection;  result = GetSelection(getter_AddRefs(selection));  if (NS_FAILED(result)) return result;  if (!selection) return NS_ERROR_NULL_POINTER;  result = selection->Collapse(parentSelectedNode, offsetOfNewNode+1);  return result;}