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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user