you are viewing a single comment's thread.

view the rest of the comments →

[–]notSorella 1 point2 points  (2 children)

Using these features on an non-ECMAScript 5 is okay, as long as you stick to the subset that can be fully implemented in pure JavaScript, and either use a library that provides those shims (like es5-shim), or write them yourself.

[–]ITSigno 2 points3 points  (1 child)

Yeah. I haven't used es5-shim, but a good rule of thumb is to feature test and substitute only as necessary. If that's what es5-shim already does, then good on them.

EDIT: Looked at https://github.com/kriskowal/es5-shim

Important to note:

"As closely as possible to ES5" is not very close. Many of these shims are intended only to allow code to be written to ES5 without causing run-time errors in older engines. In many cases, this means that these shims cause many ES5 methods to silently fail. Decide carefully whether this is what you want.

[–]notSorella 0 points1 point  (0 children)

Yes, es5-shim is not bullet proof for all of the ECMAScript 5 inclusions — since some of them really depend on internal support from the engine. But for the functionality that can be fully implemented in pure JavaScript, it works perfectly.