Commit 87b762f2 authored by jhawkins@chromium.org's avatar jhawkins@chromium.org

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
parent 82aff3f9
......@@ -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;
}
......
......@@ -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';
}
},
};
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment