rv = RemoveElementFromMap(aOldChild, PR_TRUE);
rv = DoForSubtree(aOldChild, RemoveElementFromDocument, nsnull);
XULDocumentImpl::ContentReplaced(nsIContent* aContainer,                                 nsIContent* aOldChild,                                 nsIContent* aNewChild,                                 PRInt32 aIndexInContainer){    // First update our element map    {        nsresult rv;        rv = RemoveElementFromMap(aOldChild, PR_TRUE);        if (NS_FAILED(rv)) return rv;        rv = AddElementToMap(aNewChild, PR_TRUE);        if (NS_FAILED(rv)) return rv;    }    // Now notify external observers    for (PRInt32 i = 0; i < mObservers.Count(); i++) {        nsIDocumentObserver*  observer = (nsIDocumentObserver*)mObservers[i];        observer->ContentReplaced(this, aContainer, aOldChild, aNewChild,                                  aIndexInContainer);        if (observer != (nsIDocumentObserver*)mObservers.ElementAt(i)) {          i--;        }    }    return NS_OK;}