IE8- compatibility in doEventListeners

For IE8- : use attachEvent/detachEvent instead of addEventListener/removeEventListener
pull/47/head
Ruben Almeida 7 years ago committed by GitHub
parent 05592ce362
commit c957428e69

@ -95,7 +95,8 @@
return new initConfig.klass(initConfig); return new initConfig.klass(initConfig);
}, },
doEventListeners = function(elm, multiple, off) { doEventListeners = function(elm, multiple, off) {
var onOff = off ? 'removeEventListener' : 'addEventListener', var ie8 = !document.addEventListener,
onOff = off ? (ie8?'detachEvent':'removeEventListener') : (ie8?'attachEvent':'addEventListener'),
focusListener = function(e) { focusListener = function(e) {
var input = this, var input = this,
position = window.ColorPicker.getOrigin(input), position = window.ColorPicker.getOrigin(input),
@ -233,4 +234,4 @@
(options.secure ? '; secure' : ''); (options.secure ? '; secure' : '');
} }
}; };
})(this); })(this);

Loading…
Cancel
Save