Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 if (typeof Element.prototype.addEventListener != "function") | 1 if (typeof window.addEventListener != "function") |
2 { | 2 { |
3 Element.prototype.addEventListener = function(type, handler, capture) | 3 window.addEventListener = function(type, handler, capture) |
4 { | 4 { |
5 this.attachEvent("on" + type, handler) | 5 this.attachEvent("on" + type, handler) |
6 }; | 6 }; |
7 } | 7 } |
8 | 8 |
9 if (typeof Element.prototype.removeEventListener != "function") | 9 if (typeof window.removeEventListener != "function") |
10 { | 10 { |
11 Element.prototype.removeEventListener = function(type, handler) | 11 window.removeEventListener = function(type, handler) |
12 { | 12 { |
13 this.detachEvent("on" + type, handler) | 13 this.detachEvent("on" + type, handler) |
14 }; | 14 }; |
15 } | 15 } |
16 | 16 |
17 if (Window.addEventListener != "function") | 17 if (typeof Element.prototype.addEventListener != "function") |
Felix Dahlke
2014/08/08 13:22:33
Either Window.prototype or window, not Window.
An
| |
18 { | 18 { |
19 Window.prototype.addEventListener = Element.prototype.addEventListener; | 19 Element.prototype.addEventListener = window.addEventListener; |
Oleksandr
2014/08/08 14:19:34
Looks like we've tried every combination now :)
Felix Dahlke
2014/08/08 14:21:12
Yes, I like this one best :)
| |
20 } | 20 } |
21 | 21 |
22 if (Window.removeEventListener != "function") | 22 if (typeof Element.prototype.removeEventListener != "function") |
23 { | 23 { |
24 Window.prototype.removeEventListener = Element.prototype.removeEventListener;» | 24 Element.prototype.removeEventListener = window.removeEventListener; |
25 } | 25 } |
LEFT | RIGHT |