|
136 | 136 | * The template metadata object returned from this method has the following |
137 | 137 | * structure (many fields optional): |
138 | 138 | * |
| 139 | + * ```js |
139 | 140 | * { |
140 | 141 | * // Flattened list of node metadata (for nodes that generated metadata) |
141 | 142 | * nodeInfoList: [ |
142 | 143 | * { |
143 | 144 | * // `id` attribute for any nodes with id's for generating `$` map |
144 | | - * id: '<id>', |
| 145 | + * id: {string}, |
145 | 146 | * // `on-event="handler"` metadata |
146 | 147 | * events: [ |
147 | 148 | * { |
148 | | - * name: '<name>' |
149 | | - * value: '<handler name>' |
| 149 | + * name: {string}, // event name |
| 150 | + * value: {string}, // handler method name |
150 | 151 | * }, ... |
151 | 152 | * ], |
152 | 153 | * // Notes when the template contained a `<slot>` for shady DOM |
153 | 154 | * // optimization purposes |
154 | | - * hasInsertionPoint: <boolean>, |
155 | | - * // For nested <template> nodes, nested template metadata |
156 | | - * templateInfo: <nested template metadata>, |
| 155 | + * hasInsertionPoint: {boolean}, |
| 156 | + * // For nested `<template>`` nodes, nested template metadata |
| 157 | + * templateInfo: {object}, // nested template metadata |
157 | 158 | * // Metadata to allow efficient retrieval of instanced node |
158 | 159 | * // corresponding to this metadata |
159 | | - * parentInfo: <reference to parent nodeInfo>, |
160 | | - * parentIndex: <integer index in parent's `childNodes` collection> |
161 | | - * infoIndex: <integer index of this `nodeInfo` in `templateInfo.nodeInfoList` |
| 160 | + * parentInfo: {number}, // reference to parent nodeInfo> |
| 161 | + * parentIndex: {number}, // index in parent's `childNodes` collection |
| 162 | + * infoIndex: {number}, // index of this `nodeInfo` in `templateInfo.nodeInfoList` |
162 | 163 | * }, |
163 | 164 | * ... |
164 | 165 | * ], |
165 | 166 | * // When true, the template had the `strip-whitespace` attribute |
166 | 167 | * // or was nested in a template with that setting |
167 | | - * stripWhitespace: <boolean> |
| 168 | + * stripWhitespace: {boolean}, |
168 | 169 | * // For nested templates, nested template content is moved into |
169 | 170 | * // a document fragment stored here; this is an optimization to |
170 | 171 | * // avoid the cost of nested template cloning |
171 | | - * content: <DocumentFragment> |
| 172 | + * content: {DocumentFragment} |
172 | 173 | * } |
| 174 | + * ``` |
173 | 175 | * |
174 | 176 | * This method kicks off a recursive treewalk as follows: |
175 | 177 | * |
| 178 | + * ``` |
176 | 179 | * _parseTemplate <---------------------+ |
177 | 180 | * _parseTemplateContent | |
178 | 181 | * _parseTemplateNode <------------|--+ |
|
181 | 184 | * _parseTemplateNodeAttributes |
182 | 185 | * _parseTemplateNodeAttribute |
183 | 186 | * |
| 187 | + * ``` |
| 188 | + * |
184 | 189 | * These methods may be overridden to add custom metadata about templates |
185 | 190 | * to either `templateInfo` or `nodeInfo`. |
186 | 191 | * |
|
396 | 401 | * |
397 | 402 | * Note that the memoized template parsing process is destructive to the |
398 | 403 | * template: attributes for bindings and declarative event listeners are |
399 | | - * removed after being noted in notes, and any nested <template>.content |
| 404 | + * removed after being noted in notes, and any nested `<template>.content` |
400 | 405 | * is removed and stored in notes as well. |
401 | 406 | * |
402 | 407 | * @param {HTMLTemplateElement} template Template to stamp |
|
0 commit comments