Skip to content

Commit

Permalink
#1309 fix adding/removing event handlers in IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels Doucet committed Jul 24, 2014
1 parent b1c3bd4 commit 472988d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ vjs.on = function(elem, type, fn){
}

if (data.handlers[type].length == 1) {
if (document.addEventListener) {
if (elem.addEventListener) {
elem.addEventListener(type, data.dispatcher, false);
} else if (document.attachEvent) {
} else if (elem.attachEvent) {
elem.attachEvent('on' + type, data.dispatcher);
}
}
Expand Down Expand Up @@ -136,9 +136,9 @@ vjs.cleanUpEvents = function(elem, type) {
// Setting to null was causing an error with data.handlers

// Remove the meta-handler from the element
if (document.removeEventListener) {
if (elem.removeEventListener) {
elem.removeEventListener(type, data.dispatcher, false);
} else if (document.detachEvent) {
} else if (elem.detachEvent) {
elem.detachEvent('on' + type, data.dispatcher);
}
}
Expand Down

0 comments on commit 472988d

Please sign in to comment.