Skip to content

Commit

Permalink
fix: $off should ignore undefined handler argument
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and ztlevi committed Feb 14, 2018
1 parent b29a672 commit 85fa28d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/core/instance/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ export function eventsMixin (Vue: Class<Component>) {
vm._events[event] = null
return vm
}
// specific handler
let cb
let i = cbs.length
while (i--) {
cb = cbs[i]
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1)
break
if (fn) {
// specific handler
let cb
let i = cbs.length
while (i--) {
cb = cbs[i]
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1)
break
}
}
}
return vm
Expand Down

0 comments on commit 85fa28d

Please sign in to comment.