summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 18:54:16 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-20 18:54:16 +0000
commit87b762f2d95922e2f17c42e8277c2d6c00515728 (patch)
tree2b7d266f8847a8681cf3a7a8c906bf6e44d390ec
parent82aff3f9755be6176092244cc76ced588076dcdb (diff)
downloadchromium_src-87b762f2d95922e2f17c42e8277c2d6c00515728.zip
chromium_src-87b762f2d95922e2f17c42e8277c2d6c00515728.tar.gz
chromium_src-87b762f2d95922e2f17c42e8277c2d6c00515728.tar.bz2
DOMUI: Use dispatchSimpleEvent instead of programatically clicking the checkbox
to notify the control that the checked state has changed. BUG=69613 TEST=none Review URL: http://codereview.chromium.org/6285003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71973 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/options/personal_options.js14
-rw-r--r--chrome/browser/resources/options/pref_ui.js4
2 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 7a92a94..66d5d00 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -100,15 +100,21 @@ 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();
+ if (!syncCheckboxes[i].checked) {
+ syncCheckboxes[i].checked = true;
+
+ // Merely setting checked = true is not enough to trigger the pref
+ // being set; thus, we dispatch a change event to notify
+ // PrefCheckbox |checked| has changed.
+ cr.dispatchSimpleEvent(syncCheckboxes[i], 'change');
+ }
syncCheckboxes[i].disabled = true;
}
diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js
index b6f495c..99db298 100644
--- a/chrome/browser/resources/options/pref_ui.js
+++ b/chrome/browser/resources/options/pref_ui.js
@@ -50,7 +50,7 @@ cr.define('options', function() {
// Listen to user events.
this.addEventListener(
- 'click',
+ 'change',
function(e) {
var value = self.inverted_pref ? !self.checked : self.checked;
switch(self.valueType) {
@@ -72,7 +72,7 @@ cr.define('options', function() {
*/
initializeValueType: function(valueType) {
this.valueType = valueType || 'boolean';
- }
+ },
};
/**