2
0
mirror of https://github.com/PitPik/colorPicker.git synced 2025-09-24 16:40:57 -06:00

IE8- compatibility in doEventListeners

For IE8- : use attachEvent/detachEvent instead of addEventListener/removeEventListener
This commit is contained in:
Ruben Almeida 2017-01-26 21:05:52 +01:00 committed by GitHub
parent 05592ce362
commit c957428e69

View File

@ -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),