Skip to content

Commit

Permalink
Fix perf regressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Apr 13, 2017
1 parent d0bd96d commit 86e35e3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,12 @@
* @private
*/
function addNotifyListener(node, inst, binding) {
let part = binding.parts[0];
node.addEventListener(binding.listenerEvent, function(e) {
handleNotification(e, inst, binding.target, part.source, part.negate);
});
if (binding.listenerEvent) {
let part = binding.parts[0];
node.addEventListener(binding.listenerEvent, function(e) {
handleNotification(e, inst, binding.target, part.source, part.negate);
});
}
}

// -- for method-based effects (complexObserver & computed) --------------
Expand Down Expand Up @@ -2028,6 +2030,7 @@
// For instance-time binding, create instance of template metadata
// and link into list of templates if necessary
templateInfo = Object.create(templateInfo);
templateInfo.wasPreBound = wasPreBound;
if (!wasPreBound && this.__templateInfo) {
templateInfo.nextTemplateInfo = this.__templateInfo;
this.__templateInfo.previousTemplateInfo = templateInfo;
Expand Down Expand Up @@ -2079,7 +2082,13 @@
let templateInfo = this._bindTemplate(template, true);
// Add template-instance-specific data to instanced templateInfo
templateInfo.nodeList = dom.nodeList;
templateInfo.childNodes = Array.from(dom.childNodes);
// Capture child nodes to allow unstamping of non-prototypical templates
if (!templateInfo.wasPreBound) {
let nodes = templateInfo.childNodes = [];
for (let n=dom.firstChild; n; n=n.nextSibling) {
nodes.push(n);
}
}
dom.templateInfo = templateInfo;
// Setup compound storage, 2-way listeners, and dataHost for bindings
setupBindings(this, templateInfo);
Expand Down

0 comments on commit 86e35e3

Please sign in to comment.