aName,
aNameSpaceID, aName,
RDFElementImpl::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify){    NS_ASSERTION(nsnull != aName, "must have attribute name");    if (nsnull == aName) {        return NS_ERROR_NULL_POINTER;    }    // Check to see if the CLASS attribute is being unset.  If so, we need to delete our    // class list.    if (mDocument && (aNameSpaceID == kNameSpaceID_None) && aName == kClassAtom) {      mAttributes->UpdateClassList("");    }        if (mDocument && (aNameSpaceID == kNameSpaceID_None) && aName == kStyleAtom) {        nsCOMPtr <nsIURI> docURL;        if (nsnull != mDocument) {            mDocument->GetBaseURL(*getter_AddRefs(docURL));        }        mAttributes->UpdateStyleRule(docURL, "");        // XXX Some kind of special document update might need to happen here.    }    // Need to check for the SELECTED attribute    // being unset.  If we're a <treeitem>, <treerow>, or <treecell>, the act of    // unsetting these attributes forces us to update our selected arrays.    nsCOMPtr<nsIAtom> tag;    GetTag(*getter_AddRefs(tag));    if (mDocument && (aNameSpaceID == kNameSpaceID_None)) {      // See if we're a treeitem atom.      // XXX Forgive me father, for I know exactly what I do, and I'm      // doing it anyway.  Need to make an nsIRDFNodeList interface that      // I can QI to for additions and removals of nodes.  For now      // do an evil cast.      nsCOMPtr<nsIRDFNodeList> nodeList;      if (tag && (tag.get() == kTreeItemAtom) && (aName == kSelectedAtom)) {        nsCOMPtr<nsIDOMXULTreeElement> treeElement;        GetParentTree(getter_AddRefs(treeElement));        if (treeElement) {          nsCOMPtr<nsIDOMNodeList> nodes;          treeElement->GetSelectedItems(getter_AddRefs(nodes));          nodeList = do_QueryInterface(nodes);        }      }      else if (tag && (tag.get() == kTreeCellAtom) && (aName == kSelectedAtom)) {        nsCOMPtr<nsIDOMXULTreeElement> treeElement;        GetParentTree(getter_AddRefs(treeElement));        if (treeElement) {          nsCOMPtr<nsIDOMNodeList> nodes;          treeElement->GetSelectedCells(getter_AddRefs(nodes));          nodeList = do_QueryInterface(nodes);        }      }      if (nodeList) {        // Remove this node from the list.        nodeList->RemoveNode(this);      }    }    // XXX Know how to remove POPUP event listeners when an attribute is unset?    nsAutoString oldValue;    nsresult rv = NS_OK;    PRBool successful = PR_FALSE;    if (nsnull != mAttributes) {        PRInt32 count = mAttributes->Count();        PRInt32 i;        for (i = 0; i < count; i++) {            nsXULAttribute* attr = (nsXULAttribute*)mAttributes->ElementAt(i);            if ((attr->mNameSpaceID == aNameSpaceID) && (attr->mName == aName)) {                oldValue = attr->mValue;                mAttributes->RemoveElementAt(i);                NS_RELEASE(attr);                successful = PR_TRUE;                break;            }        }    }    // XUL Only. Find out if we have a broadcast listener for this element.    if (successful) {      // Check to see if the OBSERVES attribute is being unset.  If so, we need to remove      // ourselves completely.      if (mDocument && (aNameSpaceID == kNameSpaceID_None) &&           (aName == kObservesAtom))      {        // Do a getElementById to retrieve the broadcaster.        nsCOMPtr<nsIDOMElement> broadcaster;        nsCOMPtr<nsIDOMXULDocument> domDoc = do_QueryInterface(mDocument);        domDoc->GetElementById(oldValue, getter_AddRefs(broadcaster));        if (broadcaster) {          nsCOMPtr<nsIDOMXULElement> xulBroadcaster = do_QueryInterface(broadcaster);          if (xulBroadcaster) {            xulBroadcaster->RemoveBroadcastListener("*", this);          }        }      }      if (mBroadcastListeners != nsnull) {        PRInt32 count = mBroadcastListeners->Count();        for (PRInt32 i = 0; i < count; i++)        {            XULBroadcastListener* xulListener = (XULBroadcastListener*)mBroadcastListeners->ElementAt(i);            nsAutoString str;            aName->ToString(str);            if (xulListener->ObservingAttribute(str) &&                (aName != kIdAtom)) {                // XXX Should have a function that knows which attributes are special.                // Unset the attribute in the broadcast listener.                nsCOMPtr<nsIDOMElement> element;                element = do_QueryInterface(xulListener->mListener);                if (element)                  element->RemoveAttribute(str);            }        }      }         // Notify document      if (NS_SUCCEEDED(rv) && aNotify && (nsnull != mDocument)) {          mDocument->AttributeChanged(NS_STATIC_CAST(nsIStyledContent*, this),                                      aName,                                      NS_STYLE_HINT_UNKNOWN);      }    }    // End XUL Only Code    return rv;}