Don't add entries for <xbl:children> tags to our attr change table, since those

are removed from the anonymous content.  Bug 282537, r+sr=bryner
This commit is contained in:
bzbarsky%mit.edu 2005-03-08 02:31:27 +00:00
parent 7d5e76b769
commit 73caaf6764

View File

@ -280,6 +280,9 @@ nsXBLPrototypeBinding::Initialize()
{
nsIContent* content = GetImmediateChild(nsXBLAtoms::content);
if (content) {
// Make sure to construct the attribute table first, since constructing the
// insertion point table removes some of the subtrees, which makes them
// unreachable by walking our DOM.
ConstructAttributeTable(content);
ConstructInsertionTable(content);
}
@ -976,13 +979,19 @@ DeleteAttributeTable(nsHashKey* aKey, void* aData, void* aClosure)
void
nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
{
// Don't add entries for <children> elements, since those will get
// removed from the DOM when we construct the insertion point table.
nsINodeInfo* nodeInfo = aElement->GetNodeInfo();
if (nodeInfo && !nodeInfo->Equals(nsXBLAtoms::children,
kNameSpaceID_XBL)) {
nsAutoString inherits;
aElement->GetAttr(kNameSpaceID_XBL, nsXBLAtoms::inherits, inherits);
if (!inherits.IsEmpty()) {
if (!mAttributeTable) {
mAttributeTable = new nsObjectHashtable(nsnull, nsnull,
DeleteAttributeTable, nsnull, 4);
DeleteAttributeTable,
nsnull, 4);
if (!mAttributeTable)
return;
}
@ -1037,7 +1046,8 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
NS_STATIC_CAST(nsObjectHashtable*, mAttributeTable->Get(&nskey));
if (!attributesNS) {
attributesNS = new nsObjectHashtable(nsnull, nsnull,
DeleteAttributeEntry, nsnull, 4);
DeleteAttributeEntry,
nsnull, 4);
if (!attributesNS)
return;
@ -1076,6 +1086,7 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
nsMemory::Free(str);
}
}
// Recur into our children.
PRUint32 childCount = aElement->GetChildCount();