compat.js: add removeEventListener - jscancer - Javascript crap (relatively sma… | |
git clone git://git.codemadness.org/jscancer | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit a6b030dbb1c1443be3b756c189603688db70c330 | |
parent a77d319fff5f1465898d949c51b940b0051cfcaa | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Thu, 2 Jun 2016 18:54:01 +0200 | |
compat.js: add removeEventListener | |
Diffstat: | |
M compat.js | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/compat.js b/compat.js | |
@@ -16,7 +16,6 @@ if (typeof(Array) != "undefined" && typeof(Element) != "undef… | |
l.push(fn(this[i])); | |
return l; | |
}; | |
- // TODO: fix for IE8. | |
if (!document.getElementsByClassName) | |
Element.prototype.getElementsByClassName = document.getElement… | |
var els = this.getElementsByTagName("*"), l = [], | |
@@ -39,6 +38,11 @@ if (typeof(Array) != "undefined" && typeof(Element) != "unde… | |
return fn.apply(this, arguments); | |
}); | |
}; | |
+ if (!document.removeEventListener) | |
+ if (this.detachEvent) // IE DOM | |
+ Element.prototype.removeEventListener = document.remov… | |
+ this.detachEvent("on" + ev, fn); | |
+ }; | |
if (!Event.prototype.stopPropagation) | |
Event.prototype.stopPropagation = function() { | |
window.event.cancelBubble = true; |