Bug 982322 - Part 4: Save paths on each node. r=ochameau

This commit is contained in:
"J. Ryan Stinnett" 2014-03-17 12:02:00 +01:00
parent c1ba262c38
commit 8ccc9f5e7c

View File

@ -142,14 +142,16 @@ Template.prototype = {
},
_unregisterNodes: function(nodes) {
for (let [registeredPath, set] of this._nodeListeners) {
for (let e of nodes) {
for (let registeredPath of e.registeredPaths) {
let set = this._nodeListeners.get(registeredPath);
set.delete(e);
}
if (set.size == 0) {
if (set.size === 0) {
this._nodeListeners.delete(registeredPath);
}
}
e.registeredPaths = null;
}
},
_registerLoop: function(path, element) {
@ -240,6 +242,8 @@ Template.prototype = {
this._registerNode(path, e);
}
}
// Store all the paths on the node, to speed up unregistering later
e.registeredPaths = paths;
} catch(exception) {
console.error("Invalid template: " + e.outerHTML + " (" + exception + ")");
}