Browse Source

use null check for old attrs

Evan You 10 years ago
parent
commit
f3970f8c5a
1 changed files with 1 additions and 1 deletions
  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)
   // 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
   // the other option is to remove all attributes with value == undefined
   for (key in oldAttrs) {
   for (key in oldAttrs) {
-    if (!(key in attrs)) {
+    if (attrs[key] == null) {
       elm.removeAttribute(key)
       elm.removeAttribute(key)
     }
     }
   }
   }