[XFA] Update select and option element attributes with the stored data and

removes the 'selected' attribute from option element if it's not actually selected.
This commit is contained in:
TaTo30 2023-07-19 19:18:40 -06:00
parent ee373b313b
commit 18619ce4c9

View File

@ -79,9 +79,12 @@ class XfaLayer {
break;
case "select":
if (storedData.value !== null) {
html.setAttribute("value", storedData.value);
for (const option of element.children) {
if (option.attributes.value === storedData.value) {
option.attributes.selected = true;
} else if (option.attributes.hasOwnProperty("selected")) {
delete option.attributes.selected;
}
}
}