feat: add observer for 'selected' setter of HTMLOptionElement and try to fix issue #746 (#810)

* feat: add observer for 'selected' setter of HTMLOptionElement and try to fix issue #746

* style: add description of mechanism
This commit is contained in:
Yun Feng
2022-01-26 16:54:39 +11:00
committed by GitHub
parent 0c27ad22b2
commit 156b760a33
3 changed files with 10 additions and 4 deletions

View File

@@ -491,7 +491,7 @@ function serializeNode(
}
}
if (tagName === 'option') {
if ((n as HTMLOptionElement).selected) {
if ((n as HTMLOptionElement).selected && !maskInputOptions['select']) {
attributes.selected = true;
} else {
// ignore the html attribute (which corresponds to DOM (n as HTMLOptionElement).defaultSelected)