Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.23.0 compatibility issue with IE7 and IE8 #144

Closed
nskate opened this issue Mar 4, 2016 · 3 comments
Closed

v0.23.0 compatibility issue with IE7 and IE8 #144

nskate opened this issue Mar 4, 2016 · 3 comments

Comments

@nskate
Copy link

nskate commented Mar 4, 2016

The new v0.23.0+ utilizes the filter() function, which is not compatible with IE7 and IE8 since those browsers don't have that function. Would be great for IE7 and IE8 compatibility version.

@simison
Copy link
Contributor

simison commented Mar 4, 2016

Meanwhile you could add this polyfill to your app, via Mozilla:

if (!Array.prototype.filter) {
  Array.prototype.filter = function(fun/*, thisArg*/) {
    'use strict';

    if (this === void 0 || this === null) {
      throw new TypeError();
    }

    var t = Object(this);
    var len = t.length >>> 0;
    if (typeof fun !== 'function') {
      throw new TypeError();
    }

    var res = [];
    var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
    for (var i = 0; i < len; i++) {
      if (i in t) {
        var val = t[i];

        // NOTE: Technically this should Object.defineProperty at
        //       the next index, as push can be affected by
        //       properties on Object.prototype and Array.prototype.
        //       But that method's new, and collisions should be
        //       rare, so use the more-compatible alternative.
        if (fun.call(thisArg, val, i, t)) {
          res.push(val);
        }
      }
    }

    return res;
  };
}

Personally I like approach where we forget about anything below IE9, but I understand there are situations (governments, Asian countries...) where it might feel too early.

@gregjacobs
Copy link
Owner

Ack, good call. Sorry about that. Will replace with a standard loop.

@gregjacobs
Copy link
Owner

Fixed in 0.25.0. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants