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

Unified Diff: ui/webui/resources/js/i18n_template_no_process.js

Issue 1076093002: Minimize flicker by adding a   to nodes that will have (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: estade@ review Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/js/i18n_template_no_process.js
diff --git a/ui/webui/resources/js/i18n_template_no_process.js b/ui/webui/resources/js/i18n_template_no_process.js
index 6f1f71551569c037779a2938645f90ee6fd039c7..44262810b0328671273ec433f4b6a5b0f2c24496 100644
--- a/ui/webui/resources/js/i18n_template_no_process.js
+++ b/ui/webui/resources/js/i18n_template_no_process.js
@@ -122,11 +122,11 @@ var i18nTemplate = (function() {
/**
* Processes a DOM tree with the {@code dictionary} map.
- * @param {HTMLElement} node The root of the DOM tree to process.
+ * @param {Document|Element} root The root of the DOM tree to process.
* @param {LoadTimeData} dictionary The dictionary to draw from.
*/
- function process(node, dictionary) {
- var elements = node.querySelectorAll(selector);
+ function process(root, dictionary) {
+ var elements = root.querySelectorAll(selector);
for (var element, i = 0; element = elements[i]; i++) {
for (var j = 0; j < attributeNames.length; j++) {
var name = attributeNames[j];
@@ -135,6 +135,9 @@ var i18nTemplate = (function() {
handlers[name](element, attribute, dictionary);
}
}
+ var doc = root instanceof Document ? root : root.ownerDocument;
+ if (doc)
+ doc.documentElement.classList.add('i18n-processed');
}
return {

Powered by Google App Engine
This is Rietveld 408576698