Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: ui/webui/resources/js/i18n_template_no_process.js

Issue 1700273003: MD Settings: make <paper-drawer-panel> flip in RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
138 */ 138 */
139 function process(root, data) { 139 function process(root, data) {
140 processWithoutCycles(root, data, new Set(), true); 140 processWithoutCycles(root, data, new Set(), true);
141
142 root.dispatchEvent(new Event('i18n-processed', {
Dan Beam 2016/02/17 04:47:34 i can't use cr.dispatchSimpleEvent() because this
143 bubbles: true,
144 cancelable: false,
145 }));
141 } 146 }
142 147
143 /** 148 /**
144 * Internal process() method that stops cycles while processing. 149 * Internal process() method that stops cycles while processing.
145 * @param {!ProcessingRoot} root 150 * @param {!ProcessingRoot} root
146 * @param {!LoadTimeData} data 151 * @param {!LoadTimeData} data
147 * @param {!Set<ProcessingRoot>} visited Already visited roots. 152 * @param {!Set<ProcessingRoot>} visited Already visited roots.
148 * @param {boolean} mark Whether nodes should be marked processed. 153 * @param {boolean} mark Whether nodes should be marked processed.
149 */ 154 */
150 function processWithoutCycles(root, data, visited, mark) { 155 function processWithoutCycles(root, data, visited, mark) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 var attribute = element.getAttribute(name); 211 var attribute = element.getAttribute(name);
207 if (attribute != null) 212 if (attribute != null)
208 handlers[name](element, attribute, data, visited); 213 handlers[name](element, attribute, data, visited);
209 } 214 }
210 } 215 }
211 216
212 return { 217 return {
213 process: process 218 process: process
214 }; 219 };
215 }()); 220 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698