|
692 | 692 | * @private |
693 | 693 | */ |
694 | 694 | 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 | + } |
699 | 701 | } |
700 | 702 |
|
701 | 703 | // -- for method-based effects (complexObserver & computed) -------------- |
|
2028 | 2030 | // For instance-time binding, create instance of template metadata |
2029 | 2031 | // and link into list of templates if necessary |
2030 | 2032 | templateInfo = Object.create(templateInfo); |
| 2033 | + templateInfo.wasPreBound = wasPreBound; |
2031 | 2034 | if (!wasPreBound && this.__templateInfo) { |
2032 | 2035 | templateInfo.nextTemplateInfo = this.__templateInfo; |
2033 | 2036 | this.__templateInfo.previousTemplateInfo = templateInfo; |
|
2079 | 2082 | let templateInfo = this._bindTemplate(template, true); |
2080 | 2083 | // Add template-instance-specific data to instanced templateInfo |
2081 | 2084 | 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 | + } |
2083 | 2092 | dom.templateInfo = templateInfo; |
2084 | 2093 | // Setup compound storage, 2-way listeners, and dataHost for bindings |
2085 | 2094 | setupBindings(this, templateInfo); |
|
0 commit comments