Skip to content

Commit

Permalink
use foreach instead of for to avoid weird problems
Browse files Browse the repository at this point in the history
  • Loading branch information
hinanaya committed May 23, 2024
1 parent 3ee00bb commit e114f3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ui/fields/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class OBFieldSelect extends OBField {
#loadInnerOptions() {
var options = {};

for (const child of this.children) {
Array.from(this.children).forEach((child) => {
if (child.tagName === 'OB-OPTION') {
let key = child.getAttribute('value');
if (key) {
Expand All @@ -381,7 +381,7 @@ class OBFieldSelect extends OBField {
options[Object.keys(options).length] = child.innerHTML;
}
}
}
});

return options;
}
Expand All @@ -395,7 +395,7 @@ class OBFieldSelect extends OBField {
}

let index = 0;
for (const child of this.children) {
Array.from(this.children).forEach((child) => {
if (child.tagName === 'OB-OPTION' && child.hasAttribute('selected')) {
let value = child.getAttribute('value');
if (! value) {
Expand All @@ -410,7 +410,7 @@ class OBFieldSelect extends OBField {
}

index = index + 1;
}
});

return selected;
}
Expand Down

0 comments on commit e114f3f

Please sign in to comment.