1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

#1309 fix adding/removing event handlers in IE8

This commit is contained in:
Niels Doucet 2014-07-24 09:13:27 +02:00
parent b1c3bd4f84
commit 472988df58

View File

@ -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);
}
}
@ -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);
}
}