最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is there a library which implements new JavascriptEcmascript 5 methods for older versions? - Stack Overflow

programmeradmin4浏览0评论

Although Ecmascript 5 introduces some pletely new features, it also adds some new methods (bind, trim, map, etc.) which should be perfectly possible to implement (albeit slower) in current versions. Does a library exist which implements these backwards patible features (and no more, excluding Prototype et. al.)

Although Ecmascript 5 introduces some pletely new features, it also adds some new methods (bind, trim, map, etc.) which should be perfectly possible to implement (albeit slower) in current versions. Does a library exist which implements these backwards patible features (and no more, excluding Prototype et. al.)

Share Improve this question edited Aug 17, 2010 at 23:40 Shog9 160k36 gold badges235 silver badges240 bronze badges asked Dec 11, 2009 at 19:50 Justin LoveJustin Love 4,45728 silver badges37 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 11

Kris Kowal and friends have built the es5-shim. It was part of Narwhal, but now lives on its own:

http://github./kriskowal/es5-shim/

Was: I've taken to using the global-es5.js shim from narwhal:

http://github./280north/narwhal/blob/master/engines/default/lib/global-es5.js

you'll have to take out the require("json"); line at the bottom, but other than that, it should be browser-clean.

Prototype and Underscore implement a lot of those.

So, I just gave up and started an ES5 library

You might want to check out pulpjs. You can pick the pieces you want to include, and then grab the protopat module, which will make a bunch of methods available as extensions on the object prototypes.

发布评论

评论列表(0)

  1. 暂无评论