| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** @typedef {Document|DocumentFragment|Element} */ | 5 /** @typedef {Document|DocumentFragment|Element} */ |
| 6 var ProcessingRoot; | 6 var ProcessingRoot; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * @fileoverview This is a simple template engine inspired by JsTemplates | 9 * @fileoverview This is a simple template engine inspired by JsTemplates |
| 10 * optimized for i18n. | 10 * optimized for i18n. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 }); | 118 }); |
| 119 } | 119 } |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 var prefixes = ['']; | 122 var prefixes = ['']; |
| 123 | 123 |
| 124 // Only look through shadow DOM when it's supported. As of April 2015, iOS | 124 // Only look through shadow DOM when it's supported. As of April 2015, iOS |
| 125 // Chrome doesn't support shadow DOM. | 125 // Chrome doesn't support shadow DOM. |
| 126 if (Element.prototype.createShadowRoot) | 126 if (Element.prototype.createShadowRoot) |
| 127 prefixes.push('::shadow '); | 127 prefixes.push('* /deep/ '); |
| 128 | 128 |
| 129 var attributeNames = Object.keys(handlers); | 129 var attributeNames = Object.keys(handlers); |
| 130 var selector = prefixes.map(function(prefix) { | 130 var selector = prefixes.map(function(prefix) { |
| 131 return prefix + '[' + attributeNames.join('], ' + prefix + '[') + ']'; | 131 return prefix + '[' + attributeNames.join('], ' + prefix + '[') + ']'; |
| 132 }).join(', '); | 132 }).join(', '); |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * Processes a DOM tree using a |data| source to populate template values. | 135 * Processes a DOM tree using a |data| source to populate template values. |
| 136 * @param {!ProcessingRoot} root The root of the DOM tree to process. | 136 * @param {!ProcessingRoot} root The root of the DOM tree to process. |
| 137 * @param {!LoadTimeData} data The data to draw from. | 137 * @param {!LoadTimeData} data The data to draw from. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 var attribute = element.getAttribute(name); | 202 var attribute = element.getAttribute(name); |
| 203 if (attribute != null) | 203 if (attribute != null) |
| 204 handlers[name](element, attribute, data, visited); | 204 handlers[name](element, attribute, data, visited); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 return { | 208 return { |
| 209 process: process | 209 process: process |
| 210 }; | 210 }; |
| 211 }()); | 211 }()); |
| OLD | NEW |