From eed67504d08b9eda8a136331c5da77548f3eba84 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Fri, 17 Mar 2017 12:55:37 +1100 Subject: [PATCH] nodeInfo -> nodeInfoList --- lib/mixins/property-effects.html | 7 +++-- lib/mixins/template-stamp.html | 45 ++++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 26a30824fa..f54d1f1625 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -712,8 +712,7 @@ * @param {Object} inst Instance that bas been previously bound * @private */ - function setupBindings(inst) { - let nodeInfo = inst.__templateNodeInfo; + function setupBindings(inst, nodeInfo) { if (nodeInfo.length) { for (let i=0; i < nodeInfo.length; i++) { let info = nodeInfo[i]; @@ -1673,7 +1672,7 @@ */ _stampTemplate(template) { let dom = super._stampTemplate(template); - setupBindings(this); + setupBindings(this, template._templateInfo.nodeInfoList); return dom; } @@ -2155,7 +2154,7 @@ this.__propagateEffects = {}; this.__notifyListeners = []; let templateInfo = this.constructor._parseTemplate(template); - let nodeInfo = templateInfo.nodeInfo; + let nodeInfo = templateInfo.nodeInfoList; for (let i=0, info; (i', // `id` + * // `id` attribute for any nodes with id's for generating `$` map + * id: '', + * // `on-event="handler"` metadata * events: [ * { * name: '' - * value: '' - * }, ... - * ], - * bindings: [ - * { - * kind: ['text'|'attribute'|'property'], - * mode: ['auto'|''], - * name: '' - * value: '' + * value: '' * }, ... * ], + * // DocumentFragment containing template content for + * // any nested templates found; the template content is removed + * // and cached in the template metadata, as an optimization to + * // avoid the cost of deeply cloning templates + * content: , + * // Metadata to allow efficient retrieval of instanced node + * // corresponding to this metadata * parent: , * index: * }, * ... * ] * - * @param {HTMLTemplateElement} template - * @param {Object=} outerTemplateInfo - * @return {Object} Template metadata + * Note that this method may be destructive to the template, in that + * e.g. event annotations may be removed after being noted in the + * template metadata. + * + * @param {HTMLTemplateElement} template Template to parse + * @param {Object=} outerTemplateInfo Template info from the outer + * template, for parsing nested templates + * @return {Object} Parsed template metadata */ static _parseTemplate(template, outerTemplateInfo) { // since a template may be re-used, memo-ize notes. if (!template._templateInfo) { let templateInfo = template._templateInfo || (template._templateInfo = {}); - templateInfo.nodeInfo = []; + templateInfo.nodeInfoList = []; templateInfo.stripWhiteSpace = (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) || template.hasAttribute('strip-whitespace'); @@ -222,7 +223,7 @@ } let childInfo = { index, parent: nodeInfo }; if (this._parseTemplateNode(node, templateInfo, childInfo)) { - templateInfo.nodeInfo.push(childInfo); + templateInfo.nodeInfoList.push(childInfo); } index++; } @@ -311,7 +312,7 @@ HTMLTemplateElement.decorate(template); } let templateInfo = this.constructor._parseTemplate(template); - let nodeInfo = this.__templateNodeInfo = templateInfo.nodeInfo; + let nodeInfo = templateInfo.nodeInfoList; let content = templateInfo.content || template.content; let dom = document.importNode(content, true); // NOTE: ShadyDom optimization indicating there is an insertion point