Skip to content

Commit

Permalink
Fix involuntary variable overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jun 12, 2017
1 parent d9e9721 commit 831b9bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webext-options-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ class OptSync {

static _applyToForm(options, form) {
for (const name of Object.keys(options)) {
const options = form.querySelectorAll(`[name="${name}"]`);
const [field] = options;
const els = form.querySelectorAll(`[name="${name}"]`);
const [field] = els;
if (field) {
console.info('Set option', name, 'to', options[name]);
switch (field.type) {
case 'checkbox':
field.checked = options[name];
break;
case 'radio': {
const [selected] = Array.from(options)
const [selected] = Array.from(els)
.filter(el => el.value === options[name]);
if (selected) {
selected.checked = true;
Expand Down

0 comments on commit 831b9bb

Please sign in to comment.