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

Remove indexOf from Array prototype for good IE < 9 support #55

Closed
sergii-trotsiuk opened this issue Nov 14, 2012 · 4 comments
Closed

Comments

@sergii-trotsiuk
Copy link
Contributor

var a = [1, 2];
for (var i in a) {
    alert(a[i]);
}

Shows "1", "2", "function (searchElement /*, fromIndex */ ) { "use strict"; ..."

@jamuhl
Copy link
Member

jamuhl commented Nov 15, 2012

what do you mean? If Array has no function indexOf i18next will not work - that's why i added it to prototype of Array if the function doesn't exist...

@jamuhl
Copy link
Member

jamuhl commented Dec 4, 2012

closing this one - because of lack of information.

@jamuhl jamuhl closed this as completed Dec 4, 2012
@sergii-trotsiuk
Copy link
Contributor Author

what do you mean? If Array has no function indexOf i18next will not work - that's why i added it to prototype of Array if the function doesn't exist...

I meen you can make private "indexOf" function for i18next, so don't change environment. Check this code with IE<9 and Chrome for example - http://jsfiddle.net/ZaPq9/2/

@jamuhl
Copy link
Member

jamuhl commented Dec 5, 2012

To shim behaviors not avaiable in old browsers is rather common - same does augment.js. It's even done like https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf suggests.

I see the problem if you don't check for a.ownProperty(i). As IE8 looses support on a lot of major sites this days i won't change this. But feel free to make a pull request.

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

2 participants