Răsfoiți Sursa

use null check for old attrs

Evan You 10 ani în urmă
părinte
comite
f3970f8c5a
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      src/runtime/vdom/modules/attrs.js

+ 1 - 1
src/runtime/vdom/modules/attrs.js

@@ -35,7 +35,7 @@ function updateAttrs (oldVnode, vnode) {
   // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)
   // the other option is to remove all attributes with value == undefined
   for (key in oldAttrs) {
-    if (!(key in attrs)) {
+    if (attrs[key] == null) {
       elm.removeAttribute(key)
     }
   }