Browse Source

fix v-on patching for cloned slot nodes (fix #3556)

Evan You 9 years ago
parent
commit
32971d8588
1 changed files with 9 additions and 7 deletions
  1. 9 7
      src/core/vdom/helpers.js

+ 9 - 7
src/core/vdom/helpers.js

@@ -104,13 +104,15 @@ export function updateListeners (
         }
         }
         add(event, cur.invoker, capture)
         add(event, cur.invoker, capture)
       }
       }
-    } else if (Array.isArray(old)) {
-      old.length = cur.length
-      for (let i = 0; i < old.length; i++) old[i] = cur[i]
-      on[name] = old
-    } else {
-      old.fn = cur
-      on[name] = old
+    } else if (cur !== old) {
+      if (Array.isArray(old)) {
+        old.length = cur.length
+        for (let i = 0; i < old.length; i++) old[i] = cur[i]
+        on[name] = old
+      } else {
+        old.fn = cur
+        on[name] = old
+      }
     }
     }
   }
   }
   for (name in oldOn) {
   for (name in oldOn) {