Skip to content Skip to sidebar Skip to footer

Mixitup Javascript Doesn't Work In Internet Explorer

The following code regarding Mixitup.js doesn't work in Internet Explorer but working fine in all other browsers. Could anyone help with this or could adjust the code for working

Solution 1:

I run your code in IE and it shows error Object doesn't support property or method 'forEach'. ForEach is defined for NodeList not HTMLCollection. We can polyfill forEach for HTMLCollection then it can be used for both NodeList and HTMLCollection in IE.

Polyfill:

var ctors = [typeofNodeList !== "undefined" && NodeList, typeofHTMLCollection !== "undefined" && HTMLCollection];
for (var n = 0; n < ctors.length; ++n) {
    var ctor = ctors[n];
    if (ctor && ctor.prototype && !ctor.prototype.forEach) {
        // (Yes, there's really no need for `Object.defineProperty` when doing the `forEach`)
        ctor.prototype.forEach = Array.prototype.forEach;
        if (typeofSymbol !== "undefined" && Symbol.iterator && !ctor.prototype[Symbol.iterator]) {
            Object.defineProperty(ctor.prototype, Symbol.iterator, {
                value: Array.prototype[Symbol.itereator],
                writable: true,
                configurable: true
            });
        }
    }
}

Post a Comment for "Mixitup Javascript Doesn't Work In Internet Explorer"