Fix setting option value to an empty string (#4176)

* Fix setting option value to an empty string

* fix formatting
This commit is contained in:
Evan Almloff authored and GitHub committed 2025-05-24 12:44:54 +01:00
1 parent ad8c869ba2
commit 40ce4c269d
9 files changed
+21 -11

No files matched your search

+9 -3
View File
@@ -22,10 +22,16 @@ export function setAttributeInner(
// A few attributes are need to be set with either boolean values or require some sort of translation
switch (field) {
case "value":
// @ts-ignore
if (node.value !== value) {
// If this is a option element, set the attribute normally
if (node.tagName === "OPTION") {
setAttributeDefault(node, field, value);
} else {
// Otherwise, set the property if it has changed
// @ts-ignore
node.value = value;
if (node.value !== value) {
// @ts-ignore
node.value = value;
}
}
break;