7

Is there already a opensource project out there which implements ECMAScript 5 features for browsers which do no implement it natively? Something like the IE7.js project which implements missing standard stuff in Internet Explorer.

I'd like to use the new Function.bind() and String.trim() and JSON.parse() functions but they are currently only available in the newest browsers like the latest Chromium. I'd like to simply include a script like "ecma5.js" which then implements all this stuff if missing in the browser.

So is there already a project like this available? If not then I have to do it myself.

4

3 回答 3

4

es5-shim应该给你你想要的(或者,尽可能接近它......一定要阅读警告)。您可以在此处找到其他 polyfill的列表。

于 2011-03-15T15:38:48.393 回答
2

DDR-ECMA5库旨在满足您的要求。当然,不是所有的东西都可以用 ECMAScript 3 标准来实现,但尽可能多地实现。

于 2011-03-30T20:07:14.283 回答
0

如果您不介意学习该库并自己编写一些代码,您可以在以下位置找到一些 ECMAScript 5 库的代码实现

https://developer.mozilla.org/En/JavaScript/ECMAScript_5_support_in_Mozilla

例如Array.filter的代码

然后 Crockford 在 json2.js 中有 JSON.parse/stringify

https://github.com/douglascrockford/JSON-js

于 2011-06-27T14:15:11.923 回答