Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

replace helper methods with ES5/ES5 shim #667

Closed
IgorMinar opened this issue Nov 19, 2011 · 10 comments
Closed

replace helper methods with ES5/ES5 shim #667

IgorMinar opened this issue Nov 19, 2011 · 10 comments
Labels

Comments

@IgorMinar
Copy link
Contributor

stuff like indexOf and friends are part of ES5 and available in modern browsers. we don't need to redefine these.

for old browsers, we should require that an ES5 shim is loaded with the app.

this one looks respectible: https://github.com/kriskowal/es5-shim

@mhevery
Copy link
Contributor

mhevery commented Nov 19, 2011

good idea, but 8.3 KB is heavy, so we should only load it when the browser needs it.

@IgorMinar
Copy link
Contributor Author

I don't want it to be part of angular.js. we'll just make a requirement that the shim is available when using old browsers.

@mhevery
Copy link
Contributor

mhevery commented Nov 19, 2011

that puts the complexity on the user, which I think is outside of the spirit of angular. We should load it, just as we used to lad the ie-compat

@IgorMinar
Copy link
Contributor Author

we can be nice and load it if needed, but we should not distribute the shim with angular. instead, we should have a config option that would allow users to override the source url for the shim. by default we can just fetch it from github and if that's not desirable then the developer can specify an alternative location.

@mhevery
Copy link
Contributor

mhevery commented Nov 21, 2011

+1

@dandoyon
Copy link
Contributor

Was this ever resolved?

@mhevery
Copy link
Contributor

mhevery commented Jan 30, 2012

nope.... Could we trouble you for a pull request?

@dandoyon
Copy link
Contributor

dandoyon commented Feb 2, 2012

meaning you would like me to implement? I can look after the dust settles on my current project.

@btford
Copy link
Contributor

btford commented Jul 19, 2012

What's the status of this?

We require a JSON shim for IE7; I think it's fine to expect the user to handle shimming for ES5 aw well. It might be nice to do some check (in the un-minified version) at runtime and throw a nice "This browser doesn't have ES5 methods shimmed. See for more info."

We could also add these shims to angular-seed (and friends) and show how to asynchronously load the shims for browsers that need it.

@IgorMinar
Copy link
Contributor Author

I looked into this one again. we would benefit only from dropping custom indexOf. so I don't think its worth it to expect users to include the shim just for that on IE.

I do think that apps should include es5 shim so that their code looks better, but I'd rather not depend on this since it doesn't buy us anything.

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

No branches or pull requests

4 participants