rv = mResources.Enumerate(RemoveElementsFromMapByContent, nsnull);
rv = mResources.Enumerate(RemoveElementsFromMapByContent, aElement);
XULDocumentImpl::AttributeChanged(nsIContent* aElement,                                  nsIAtom* aAttribute,                                  PRInt32 aHint){    nsresult rv;    PRInt32 nameSpaceID;    rv = aElement->GetNameSpaceID(nameSpaceID);    if (NS_FAILED(rv)) return rv;    // First see if we need to update our element map.    if (nameSpaceID == kNameSpaceID_HTML) {        if ((aAttribute == kIdAtom) || (aAttribute == kRefAtom)) {            rv = mResources.Enumerate(RemoveElementsFromMapByContent, nsnull);            if (NS_FAILED(rv)) return rv;            // That'll have removed _both_ the 'ref' and 'id' entries from            // the map. So add 'em back now.            rv = AddElementToMap(aElement);            if (NS_FAILED(rv)) return rv;        }    }    // Now notify external observers    for (PRInt32 i = 0; i < mObservers.Count(); i++) {        nsIDocumentObserver*  observer = (nsIDocumentObserver*)mObservers[i];        observer->AttributeChanged(this, aElement, aAttribute, aHint);        if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {          i--;        }    }    // Handle "special" cases. We do this handling _after_ we've    // notified the observer to ensure that any frames that are    // caching information (e.g., the tree widget and the 'open'    // attribute) will notice things properly.    if (nameSpaceID == kNameSpaceID_XUL) {        if (aAttribute == kOpenAtom) {            nsAutoString open;            rv = aElement->GetAttribute(kNameSpaceID_None, kOpenAtom, open);            if (NS_FAILED(rv)) return rv;            if ((rv == NS_CONTENT_ATTR_HAS_VALUE) && (open.Equals("true"))) {                OpenWidgetItem(aElement);            }            else {                CloseWidgetItem(aElement);            }        }        else if (aAttribute == kRefAtom) {            RebuildWidgetItem(aElement);        }    }    // Finally, see if there is anything we need to persist in the    // localstore.    //    // XXX Namespace handling broken :-(    nsAutoString persist;    rv = aElement->GetAttribute(kNameSpaceID_None, kPersistAtom, persist);    if (NS_FAILED(rv)) return rv;    if (rv == NS_CONTENT_ATTR_HAS_VALUE) {        nsAutoString attr;        rv = aAttribute->ToString(attr);        if (NS_FAILED(rv)) return rv;        if (persist.Find(attr) >= 0) {            rv = Persist(aElement, kNameSpaceID_None, aAttribute);            if (NS_FAILED(rv)) return rv;        }    }    return NS_OK;}