Skip to content

Commit 86e35e3

Browse files
committed
Fix perf regressions.
1 parent d0bd96d commit 86e35e3

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

lib/mixins/property-effects.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,12 @@
692692
* @private
693693
*/
694694
function addNotifyListener(node, inst, binding) {
695-
let part = binding.parts[0];
696-
node.addEventListener(binding.listenerEvent, function(e) {
697-
handleNotification(e, inst, binding.target, part.source, part.negate);
698-
});
695+
if (binding.listenerEvent) {
696+
let part = binding.parts[0];
697+
node.addEventListener(binding.listenerEvent, function(e) {
698+
handleNotification(e, inst, binding.target, part.source, part.negate);
699+
});
700+
}
699701
}
700702

701703
// -- for method-based effects (complexObserver & computed) --------------
@@ -2028,6 +2030,7 @@
20282030
// For instance-time binding, create instance of template metadata
20292031
// and link into list of templates if necessary
20302032
templateInfo = Object.create(templateInfo);
2033+
templateInfo.wasPreBound = wasPreBound;
20312034
if (!wasPreBound && this.__templateInfo) {
20322035
templateInfo.nextTemplateInfo = this.__templateInfo;
20332036
this.__templateInfo.previousTemplateInfo = templateInfo;
@@ -2079,7 +2082,13 @@
20792082
let templateInfo = this._bindTemplate(template, true);
20802083
// Add template-instance-specific data to instanced templateInfo
20812084
templateInfo.nodeList = dom.nodeList;
2082-
templateInfo.childNodes = Array.from(dom.childNodes);
2085+
// Capture child nodes to allow unstamping of non-prototypical templates
2086+
if (!templateInfo.wasPreBound) {
2087+
let nodes = templateInfo.childNodes = [];
2088+
for (let n=dom.firstChild; n; n=n.nextSibling) {
2089+
nodes.push(n);
2090+
}
2091+
}
20832092
dom.templateInfo = templateInfo;
20842093
// Setup compound storage, 2-way listeners, and dataHost for bindings
20852094
setupBindings(this, templateInfo);

0 commit comments

Comments
 (0)