From 47113e7545c749464a9af7b819d01016ce2ff91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=AF=94=E5=B0=8F=E9=87=91=E5=88=9A?= <2890636389@qq.com> Date: Mon, 27 May 2019 20:57:17 +0800 Subject: [PATCH] maybe u don't want to just delete the last one. thx, this is a great repo. i think, there may be should have a condition: `this.container.watchers.splice(index, 1);` otherwise, it's just delete the last wather. --- src/watcher.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/watcher.js b/src/watcher.js index 4125ee9..c4b2d10 100644 --- a/src/watcher.js +++ b/src/watcher.js @@ -214,7 +214,9 @@ ElementWatcher.prototype = { destroy: function() { var index = this.container.watchers.indexOf(this), self = this; - this.container.watchers.splice(index, 1); + if (index !== -1) { + this.container.watchers.splice(index, 1); + } for (var i = 0, j = eventTypes.length; i < j; i++) { self.callbacks[eventTypes[i]].length = 0; }