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

Unified Diff: chrome/browser/resources/options/personal_options.js

Issue 6285003: DOMUI: Use dispatchSimpleEvent instead of programatically clicking the checkbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | chrome/browser/resources/options/pref_ui.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/personal_options.js
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 7a92a942ffa5a479de46eb472358ef9256cbfc8a..17952e4057b1810eea0f1b36fad39f0bbd4e9936 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -100,17 +100,20 @@ cr.define('options', function() {
var idx = $('sync-select').selectedIndex;
var syncCheckboxes = $('sync-table').getElementsByTagName('input');
if (idx == 0) {
+ // 'Choose what to sync.'
for (var i = 0; i < syncCheckboxes.length; i++) {
syncCheckboxes[i].disabled = false;
}
} else if (idx == 1) {
+ // 'Everything' is synced.
for (var i = 0; i < syncCheckboxes.length; i++) {
- // Merely setting checked = true is not enough to trigger the pref
- // being set; thus, we simulate the click.
- if (!syncCheckboxes[i].checked)
- syncCheckboxes[i].click();
-
+ syncCheckboxes[i].checked = true;
syncCheckboxes[i].disabled = true;
+
+ // Merely setting checked = true is not enough to trigger the pref
+ // being set; thus, we dispatch a change even to notify PrefCheckbox
+ // |checked| has changed.
+ cr.dispatchSimpleEvent(syncCheckboxes[i], 'change')
stuartmorgan 2011/01/20 18:19:42 Shouldn't you only send this if it wasn't previous
James Hawkins 2011/01/20 18:25:13 Done.
}
}
},
« no previous file with comments | « no previous file | chrome/browser/resources/options/pref_ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698