Skip to content

Commit

Permalink
remove composition event listeners in v-model unbind
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 5, 2014
1 parent 74e2f38 commit 398419f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/directives/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ module.exports = {
: 'innerHTML'

var compositionLock = false
el.addEventListener('compositionstart', function () {
this.cLock = function () {
compositionLock = true
})
el.addEventListener('compositionend', function () {
}
this.cUnlock = function () {
compositionLock = false
})
}
el.addEventListener('compositionstart', this.cLock)
el.addEventListener('compositionend', this.cUnlock)

// attach listener
self.set = self.filters
Expand Down Expand Up @@ -114,10 +116,13 @@ module.exports = {
},

unbind: function () {
this.el.removeEventListener(this.event, this.set)
var el = this.el
el.removeEventListener(this.event, this.set)
el.removeEventListener('compositionstart', this.cLock)
el.removeEventListener('compositionend', this.cUnlock)
if (isIE9) {
this.el.removeEventListener('cut', this.onCut)
this.el.removeEventListener('keyup', this.onDel)
el.removeEventListener('cut', this.onCut)
el.removeEventListener('keyup', this.onDel)
}
}
}

0 comments on commit 398419f

Please sign in to comment.