replace for..in for loops for for..of + destructuring
This commit is contained in:
parent
89a4687c81
commit
6368a9882a
11
l3config.js
11
l3config.js
|
@ -25,8 +25,8 @@ function makeText(text) {
|
||||||
function makeInput(id, attrs) {
|
function makeInput(id, attrs) {
|
||||||
let ret = document.createElement('input');
|
let ret = document.createElement('input');
|
||||||
ret.setAttribute('id', id);
|
ret.setAttribute('id', id);
|
||||||
for (const attr in attrs) {
|
for (const [attr, value] of Object.entries(attrs)) {
|
||||||
ret.setAttribute(attr, attrs[attr]);
|
ret.setAttribute(attr, value);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,7 @@ class L3Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
let optstrs = [];
|
let optstrs = [];
|
||||||
for (const opt in compiledopts) {
|
for (const [opt, values] of Object.entries(compiledopts)) {
|
||||||
const values = compiledopts[opt];
|
|
||||||
if (values.length == 1) {
|
if (values.length == 1) {
|
||||||
optstrs.push(`option ${opt} '${values[0]}'`);
|
optstrs.push(`option ${opt} '${values[0]}'`);
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,8 +207,8 @@ class L3Select {
|
||||||
|
|
||||||
this.input = document.createElement('select');
|
this.input = document.createElement('select');
|
||||||
this.input.setAttribute('id', this.id);
|
this.input.setAttribute('id', this.id);
|
||||||
for (const attr in this.attrs) {
|
for (const [attr, value] of Object.entries(this.attrs)) {
|
||||||
this.input.setAttribute(attr, this.attrs[attr]);
|
this.input.setAttribute(attr, value);
|
||||||
}
|
}
|
||||||
div.appendChild(this.input);
|
div.appendChild(this.input);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue