mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix addEventLister detection for IE9
IE9 added support for addEventListener and it looks like some new events (e.g. DOMContentLoaded) can't be registered via attachEvent, only addEventListener correctly registeres these. So to make sure we are using the latest and greatest we need to look for addEventListener instead of attachEvent in the jqLite feature detection code.
This commit is contained in:
parent
0ad39dde4f
commit
e999740044
1 changed files with 6 additions and 6 deletions
|
|
@ -5,12 +5,12 @@
|
|||
var jqCache = {},
|
||||
jqName = 'ng-' + new Date().getTime(),
|
||||
jqId = 1,
|
||||
addEventListenerFn = (window.document.attachEvent ?
|
||||
function(element, type, fn) {element.attachEvent('on' + type, fn);} :
|
||||
function(element, type, fn) {element.addEventListener(type, fn, false);}),
|
||||
removeEventListenerFn = (window.document.detachEvent ?
|
||||
function(element, type, fn) {element.detachEvent('on' + type, fn); } :
|
||||
function(element, type, fn) { element.removeEventListener(type, fn, false); });
|
||||
addEventListenerFn = (window.document.addEventListener ?
|
||||
function(element, type, fn) {element.addEventListener(type, fn, false);} :
|
||||
function(element, type, fn) {element.attachEvent('on' + type, fn);}),
|
||||
removeEventListenerFn = (window.document.removeEventListener ?
|
||||
function(element, type, fn) {element.removeEventListener(type, fn, false); } :
|
||||
function(element, type, fn) {element.detachEvent('on' + type, fn); });
|
||||
|
||||
function jqNextId() { return (jqId++); }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue