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

Unified Diff: chrome/browser/resources/shared/js/i18n_template.js

Issue 6150003: DOMUI: Implement the i18n-options attribute that allows the client to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix 2. Created 9 years, 11 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/browser/resources/options/pref_ui.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/shared/js/i18n_template.js
diff --git a/chrome/browser/resources/shared/js/i18n_template.js b/chrome/browser/resources/shared/js/i18n_template.js
index 2645bdbae507d760698e1f21c20848046c14f6e3..5b46cd11352b544b6fd5fcb37adb7f8e25b29cdf 100644
--- a/chrome/browser/resources/shared/js/i18n_template.js
+++ b/chrome/browser/resources/shared/js/i18n_template.js
@@ -39,6 +39,17 @@ var i18nTemplate = (function() {
},
/**
+ * This handler adds options to a select element.
+ */
+ 'i18n-options': function(element, attributeValue, obj) {
+ var options = obj[attributeValue];
+ options.forEach(function(values) {
+ typeof values == 'string' ? element.appendChild(new Option(values)) :
arv (Not doing code reviews) 2011/01/08 00:08:53 This was not what I had in mind... Either: var o
James Hawkins 2011/01/08 00:15:51 Done.
+ element.appendChild(new Option(values[1], values[0]));
+ });
+ },
+
+ /**
* This is used to set HTML attributes and DOM properties,. The syntax is:
* attributename:key;
* .domProperty:key;
« no previous file with comments | « chrome/browser/resources/options/pref_ui.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698