compat.js: add removeEventListener - jscancer - Javascript crap (relatively small)
 (HTM) git clone git://git.codemadness.org/jscancer
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a6b030dbb1c1443be3b756c189603688db70c330
 (DIR) parent a77d319fff5f1465898d949c51b940b0051cfcaa
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       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(-)
       ---
 (DIR) diff --git a/compat.js b/compat.js
       @@ -16,7 +16,6 @@ if (typeof(Array) != "undefined" && typeof(Element) != "undefined" &&
                                        l.push(fn(this[i]));
                                return l;
                        };
       -        // TODO: fix for IE8.
                if (!document.getElementsByClassName)
                        Element.prototype.getElementsByClassName = document.getElementsByClassName = function(classname) {
                                var els = this.getElementsByTagName("*"), l = [],
       @@ -39,6 +38,11 @@ if (typeof(Array) != "undefined" && typeof(Element) != "undefined" &&
                                                return fn.apply(this, arguments);
                                        });
                                };
       +        if (!document.removeEventListener)
       +                if (this.detachEvent) // IE DOM
       +                        Element.prototype.removeEventListener = document.removeEventListener = function(ev, fn, capture) {
       +                                this.detachEvent("on" + ev, fn);
       +                        };
                if (!Event.prototype.stopPropagation)
                        Event.prototype.stopPropagation = function() {
                                 window.event.cancelBubble = true;