是否有一个库可以在所有浏览器中创建 JavaScript 1.8 兼容性?
浏览 Mozilla JavaScript 网站,我发现 JavaScript 1.8 有很多很棒的功能。在大多数情况下,如果该功能未在用户的浏览器上实现,您可以添加代码来扩展基本类型的原型。是否有一个库可以用来添加所有这些功能,从而在您的代码中自由使用 JavaScript 1.8?
Looking through the Mozilla JavaScript site, I see that JavaScript 1.8 has a lot of great functions. In most cases it has code you can add to extend prototypes of the basic types in the case that the function is not implemented on the user's browser. Is there a library that you can use to add all those functions and therefore use JavaScript 1.8 freely in your code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能正在寻找垫片。
查看 es5-shim:https://github.com/kriskowal/es5-shim/
Modernizr 有一个非常详尽的替代 polyfill 或 shim 列表(wiki)(根据您的需要查看 ECMAScript 5):
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross -browser-Polyfills
此外,并非所有功能都可以由 shim 或 polyfill 提供。您可以针对您想要但未提供的功能发起一个问题(请记住首先搜索并阅读自述文件),开发人员可能会告诉您是否不可能。
You are probably looking for a shim.
Check out the es5-shim: https://github.com/kriskowal/es5-shim/
Modernizr has a pretty exhaustive list (wiki) of alternative polyfills or shims (look under ECMAScript 5 for your needs):
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
Also, not all features can be provided by shims or polyfills. You could start an issue (remember to search and read the README first) for a feature that you want but isn't provided and the developer might tell you if it's not possible.
由于这个版本有很多语法差异(Rob W 提到过),所以只有两种方法可以做到这一点。
不,那里没有人。
Since this version has lots of syntax differences (mentioned by Rob W), there are only two way this can be done
No, there isn't one out there.