diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index f54d1f1625..f87afc3f23 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -2172,6 +2172,22 @@ } } + /** + * Overrides default `TemplateStamp` implementation to add support for + * parsing bindings from `TextNode`'s' `textContent`. A `bindings` + * array is added to `nodeInfo` and populated with binding metadata + * with information capturing the binding target, and a `parts` array + * with one or more metadata objects capturing the source(s) of the + * binding. + * + * @override + * @param {Node} node Node to parse + * @param {Object} templateInfo Template metadata for current template + * @param {Object} nodeInfo Node metadata for current template. + * @return {boolean} `true` if the visited node added node-specific + * metadata to `nodeInfo` + * @protected + */ static _parseTemplateNode(node, templateInfo, nodeInfo) { let hostProps = templateInfo.hostProps = templateInfo.hostProps || {}; let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); @@ -2195,6 +2211,22 @@ return noted; } + /** + * Overrides default `TemplateStamp` implementation to add support for + * parsing bindings from attributes. A `bindings` + * array is added to `nodeInfo` and populated with binding metadata + * with information capturing the binding target, and a `parts` array + * with one or more metadata objects capturing the source(s) of the + * binding. + * + * @override + * @param {Node} node Node to parse + * @param {Object} templateInfo Template metadata for current template + * @param {Object} nodeInfo Node metadata for current template. + * @return {boolean} `true` if the visited node added node-specific + * metadata to `nodeInfo` + * @protected + */ static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { let parts = parseBindings(value, templateInfo.hostProps); if (parts) { @@ -2238,6 +2270,19 @@ } } + /** + * Overrides default `TemplateStamp` implementation to add support for + * binding the properties that a nested template depends on to the template + * as `_host_`. + * + * @override + * @param {Node} node Node to parse + * @param {Object} templateInfo Template metadata for current template + * @param {Object} nodeInfo Node metadata for current template. + * @return {boolean} `true` if the visited node added node-specific + * metadata to `nodeInfo` + * @protected + */ static _parseTemplateNestedContent(node, templateInfo, nodeInfo) { let noted = super._parseTemplateNestedContent(node, templateInfo, nodeInfo); // Merge host props into outer template and add bindings diff --git a/lib/mixins/template-stamp.html b/lib/mixins/template-stamp.html index f5ef87e488..acd397171f 100644 --- a/lib/mixins/template-stamp.html +++ b/lib/mixins/template-stamp.html @@ -68,10 +68,10 @@ } // install event listeners (from event annotations) - function applyEventListener(inst, node, nodeInfo, host) { + function applyEventListener(inst, node, nodeInfo) { if (nodeInfo.events && nodeInfo.events.length) { for (let j=0, e$=nodeInfo.events, e; (j', - * // `on-event="handler"` metadata - * events: [ - * { - * name: '' - * 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: - * }, - * ... - * ] + * { + * // Flattened list of node metadata (for nodes that generated metadata) + * nodeInfoList: [ + * { + * // `id` attribute for any nodes with id's for generating `$` map + * id: '', + * // `on-event="handler"` metadata + * events: [ + * { + * name: '' + * value: '' + * }, ... + * ], + * // Notes when the template contained a `` for shady DOM + * // optimization purposes + * hasInsertionPoint: , + * // For nested