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

Unified Diff: chrome/third_party/jstemplate/jstemplate.js

Issue 57025: Make the font family and the font size used in dom UI localizable. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
« no previous file with comments | « chrome/common/resource_bundle.cc ('k') | chrome/third_party/jstemplate/jstemplate_compiled.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/third_party/jstemplate/jstemplate.js
===================================================================
--- chrome/third_party/jstemplate/jstemplate.js (revision 12792)
+++ chrome/third_party/jstemplate/jstemplate.js (working copy)
@@ -528,10 +528,23 @@
context.setVariable(label, value);
} else if (label.charAt(0) == '.') {
- // A jsvalues entry whose name starts with . sets a property
- // of the current template node.
- template[label.substr(1)] = value;
-
+ // A jsvalues entry whose name starts with . sets a property of
+ // the current template node. The name may have further dot
+ // separated components, which are translated into namespace
+ // objects. This specifically allows to set properties on .style
+ // using jsvalues. NOTE(mesch): Setting the style attribute has
+ // no effect in IE and hence should not be done anyway.
+ var nameSpaceLabel = label.substr(1).split('.');
+ var nameSpaceObject = template;
+ var nameSpaceDepth = jsLength(nameSpaceLabel);
+ for (var j = 0, J = nameSpaceDepth - 1; j < J; ++j) {
+ var jLabel = nameSpaceLabel[j];
+ if (!nameSpaceObject[jLabel]) {
+ nameSpaceObject[jLabel] = {};
+ }
+ nameSpaceObject = nameSpaceObject[jLabel];
+ }
+ nameSpaceObject[nameSpaceLabel[nameSpaceDepth - 1]] = value;
} else if (label) {
// Any other jsvalues entry sets an attribute of the current
// template node.
« no previous file with comments | « chrome/common/resource_bundle.cc ('k') | chrome/third_party/jstemplate/jstemplate_compiled.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698