JavaScript 兼容性库

发布于 2024-09-12 08:48:00 字数 232 浏览 1 评论 0原文

是否有 javascript 库提供与特定实现的前向兼容性?例如,这样的库可以以可跨各种浏览器移植的方式提供 JavaScript 1.6 中存在的功能。它应该利用对该功能的本机支持(如果可用)。

JQuery 或 Prototype 等一些框架提供的功能与新版本 JS 中的功能相同,但我希望既能减少我正在使用的库的大小,又能确保完全符合标准或发布版本。

存在这样的库吗?谷歌和维基百科在这个话题上没有太多可说的。

Are there javascript libraries that provide forward compatibility with particular implementations? For example, such a library could provide features present in JavaScript 1.6 in a way that's portable across various browsers. It should take advantage of native support for that functionality when available.

Some of the frameworks like JQuery or Prototype provide features that are identical to features in newer versions of JS, but I'd like to both cut down on the size of the library I'm using and ensure full compliance with a standard or published version.

Do libraries such as this exist? Google and wikipedia don't have much to say on this topic.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

水波映月 2024-09-19 08:48:00

看起来有这样一个库:“JavaScript 标准库”(JSL)。它旨在为支持 JS 1.2 或更高版本的浏览器提供尽可能多的 JS 1.6 兼容性。

我没有使用过它,不确定它的效果如何。该文档是用粗略的英语编写的;这可能表明缺乏广泛的使用,否则现在可​​能有人已经纠正它了。

为了增加混乱,该网站链接到位于另一个网站上的 JSL 修订版,其功能列表表示它提供 main 中列出的功能的子集页面

作者写了一些关于这个库以及 此博文

It looks like there is such a library: the "JavaScript Standard Library" (JSL). It purports to provide as much JS 1.6 compatibility as possible for browsers supporting JS 1.2 or later.

I haven't used it, and am not sure of how well it works. The documentation is written in sketchy English; this could indicate a lack of widespread usage, since otherwise someone probably would have corrected it by now.

To add to the confusion, the site links to a JSL Revision, located on a different website, whose features list indicates that it provides a subset of the features listed at the main page.

The author has written some more about this library and about the general concepts involved in this blog post.

扎心 2024-09-19 08:48:00

例如,这样的库可以以可跨各种浏览器移植的方式提供 JavaScript 1.6 中存在的功能。它应该利用对该功能的本机支持(如果可用)。

这几乎就是框架所做的事情,而且做得很好(尽管它们弥补的大多数兼容性差距都与 DOM 和 CSS 相关)。我不知道有一个专注于前向兼容性的通用框架。不确定这样的东西是否存在,因为查看维基百科文章,任何版本中的许多改进都是在旧版本的语言中非常非常难以模拟的构造和行为(例如 let、表达式闭包...)

For example, such a library could provide features present in JavaScript 1.6 in a way that's portable across various browsers. It should take advantage of native support for that functionality when available.

This is pretty much what the frameworks do, and do well (even though most of the compatibility gaps they close are DOM and CSS related). I'm not aware of a general purpose framework with a focus on forward compatibility. Not sure whether something like that can exist at all, because looking at the Wikipedia article, many of the improvements in any version are constructs and behaviours that are very, very hard to simulate in an older version of the language (e.g. let, expression closures...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文