]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-dom): cast to true for boolean props
authorEvan You <yyx990803@gmail.com>
Fri, 11 Oct 2019 22:59:39 +0000 (18:59 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 11 Oct 2019 22:59:39 +0000 (18:59 -0400)
packages/runtime-dom/src/modules/props.ts

index 0e87ffcd1ef6920acca857e22e6c6b5e8fbeca15..fbaaac2c8e8c79f395d72994f2226cd2859b24f5 100644 (file)
@@ -18,5 +18,10 @@ export function patchDOMProp(
     // non-string values will be stringified.
     el._value = value
   }
-  el[key] = value == null ? '' : value
+  if (value === '' && typeof el[key] === 'boolean') {
+    // e.g. <select multiple> compiles to { multiple: '' }
+    el[key] = true
+  } else {
+    el[key] = value == null ? '' : value
+  }
 }