Fix for bug 351823 (Consider copying more properties when changing ownerDocument). r/sr=bz.

git-svn-id: svn://10.0.0.236/trunk@211854 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%propagandism.org
2006-09-16 17:15:38 +00:00
parent 5b75c7f1d9
commit 4095896649
13 changed files with 180 additions and 152 deletions

View File

@@ -663,11 +663,15 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (oldOwnerDocument && oldOwnerDocument != newOwnerDocument &&
HasProperties()) {
// Copy UserData to the new document.
nsContentUtils::CopyUserData(oldOwnerDocument, this);
nsPropertyTable *oldTable = oldOwnerDocument->PropertyTable();
if (newOwnerDocument) {
nsPropertyTable *newTable = newOwnerDocument->PropertyTable();
// Remove all properties.
oldOwnerDocument->PropertyTable()->DeleteAllPropertiesFor(this);
oldTable->TransferOrDeleteAllPropertiesFor(this, newTable);
}
else {
oldTable->DeleteAllPropertiesFor(this);
}
}
NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");