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

IE8 - Object doesn't support this property or method #147

Closed
phillipsnick opened this issue Jul 26, 2016 · 3 comments
Closed

IE8 - Object doesn't support this property or method #147

phillipsnick opened this issue Jul 26, 2016 · 3 comments

Comments

@phillipsnick
Copy link

I'm building an incompatible browser message using this library, but I can't get IE8 to work with the isUnsupportedBrowser method due to what seems to be an issue inside compareVersions.

Browser is IE 8.0.7600.16385

screen shot 2016-07-26 at 13 42 11

Line 465-468 is

return map(version.split("."), function (chunk) {
  return new Array(20 - chunk.length).join("0") + chunk;
}).reverse();

My test code can be found here: http://lsconnect.co.uk/ie/

Which is simply

if (bowser.isUnsupportedBrowser({
    msie: '10.0',
    firefox: '46',
    chrome: '50',
    safari: '8.1',
    opera: '38'
})) {
  alert('Unsupported');
} else {
  alert('Supported');
}

I have tried to debug the code but haven't made much progress with the exact cause.

@maksimr
Copy link
Contributor

maksimr commented Jul 26, 2016

Problem in function map

  function map(arr, iterator) {
    var result = [], i;
    if (Array.prototype.map) {
      return Array.prototype.map.call(arr, iterator);
    }
    for (i = 0; i < arr.length; i++) {
      result = iterator(arr[i]); // WE SHOULD PUSH RESULT OF ITERATOR TO VARIABLE result 
    }
    return result;
  }

Correct code:

  function map(arr, iterator) {
    var result = [], i;
    if (Array.prototype.map) {
      return Array.prototype.map.call(arr, iterator);
    }
    for (i = 0; i < arr.length; i++) {
      result.push(iterator(arr[i]));
    }
    return result;
  }

@phillipsnick
Copy link
Author

Works perfectly!

@lancedikson
Copy link
Collaborator

Yeah, thank you @phillipsnick and @maksimr. The patch will be released today or maybe tomorrow.

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