]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-dom): avoid always resetting nullish option value
authorEvan You <yyx990803@gmail.com>
Sun, 25 Feb 2024 09:35:19 +0000 (17:35 +0800)
committerEvan You <yyx990803@gmail.com>
Sun, 25 Feb 2024 09:35:19 +0000 (17:35 +0800)
close #10396

packages/runtime-dom/src/modules/props.ts

index 3c09a1279410e6260e694645ec9ed279dad4c8f1..e9b3bca357de636d3f0ef9b5b041337ef36e9caf 100644 (file)
@@ -39,7 +39,8 @@ export function patchDOMProp(
     el._value = value
     // #4956: <option> value will fallback to its text content so we need to
     // compare against its attribute value instead.
-    const oldValue = tag === 'OPTION' ? el.getAttribute('value') : el.value
+    const oldValue =
+      tag === 'OPTION' ? el.getAttribute('value') || '' : el.value
     const newValue = value == null ? '' : value
     if (oldValue !== newValue) {
       el.value = newValue