[].indexOf is used in plugin breaks IE8
Closed this issue · 3 comments
can3p commented
Array.prototype.indexOf is not implemented in IE8, so plugin produces error in this browser.
tvdeyen commented
Fixed it with:
if (typeof(Array.prototype.indexOf) === 'function') { // IE8 does not have indexOf() on Array.
(function(jQuery, undefined){
var props = ["changedTouches", "targetTouches"],
l = props.length;
while (l--) {
if (jQuery.event.props.indexOf(props[l]) === -1) {
jQuery.event.props.push(props[l]);
}
}
})(jQuery);
};
stephband commented
Yeah. Unfortunately that fix will stop move events working in touch devices. There are two fixes for this:
-
Include es5-shim (https://github.com/kriskowal/es5-shim) in your project, which patches up IE with polyfills for missing JavaScript methods. That's what I do.
-
Find all the points where the properties 'e.changedTouches' and 'e.targetTouches' are being read from event objects, and swap them for 'e.originalEvent.changedTouches' and 'e.originalEvent.targetTouches'. Seems like a quick win. Any volunteers?