jQuery 对向后兼容性的支持程度如何?
我们遇到了 Mootools 不太向后兼容的问题,特别是在拖放功能方面。 我想知道是否有人遇到过 jQuery 不向后兼容的类似问题。 我们开始大量使用它,并考虑升级到更新版本以开始使用多个需要它的插件。 如果我们摆脱旧版本会遇到任何问题吗?
We have had issues with Mootools not being very backward compatible specifically in the area of drag and drop functionality. I was wondering if anyone has had any similar problems with jQuery not being backward compatible. We are starting to use it quite heavily and are thinking about upgrading to a newer version to start using several plugins that require it. Will we have any issues if we get rid of the older version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
jQuery 似乎向后兼容得很好。 我已经通过几个版本的核心使用它几年多了,除了一些带有一些插件的小问题之外,升级时没有遇到任何问题。 我想说核心似乎很好,但如果你使用很多插件,你可能会遇到一些问题(但这些通常很容易修复,或者新核心无论如何都内置了该功能,所以你可以直接删除他们)。
jQuery seems to be nicely backward compatible. I have been using it for more than a couple of years now through several versions of the core and have not had issues when upgrading except a few minor ones with some plugins. I would say that the core seems to be fine but if you're using a lot of plugins you might run into some problems (but these are usually easy to fix, or the new core has that functionality built in anyway so you can just drop them).
jQuery 对于向后兼容性非常重视,以至于他们为每个版本都生成了一个“向后兼容性”插件: http://docs.jquery.com/Release:jQuery_1.2#jQuery_1.1_Compatibility_Plugin。 它可以让不需要向后兼容性的人节省页面重量。
jQuery is so serious about backwards compatibility that they produce a "backwards compatibility" plugin for each release: http://docs.jquery.com/Release:jQuery_1.2#jQuery_1.1_Compatibility_Plugin. It let people who don't need backwards compatibility save on page weight.
我的经验是,在升级时,我有时会发现以前有用的东西会损坏。 例如,当从 1.7.2 升级到 1.8.3 时,我发现一些拖放功能停止工作。 某些问题可能是由于已弃用的 jQuery 函数被删除,但仍被不兼容版本的 jQuery UI 使用。
以下是来自另一位用户的引用:
My experience is that when upgrading, I sometimes find that stuff that used to work breaks. For instance, when upgrading from 1.7.2 to 1.8.3 I found some drag-and-drop features stopped working. Some problems may be due to deprecated jQuery functions being dropped, still in use by incompatible versions of jQuery UI.
Here is a quote from another user:
jQuery 从 1.0 版本开始就产生了向后兼容的插件。
该项目具有以下向后兼容性存储库:
jquery-compat-1.0(兼容性插件从 jQuery 1.0 升级到 jQuery 1.1+)
jquery-compat-1.1(从 jQuery 1.1 升级到 jQuery 1.2+ 的兼容性插件)
jquery-xpath(为从 jQuery 1.1 升级到 jQuery 1.2 的用户实现 XPath 功能)
jquery-compat-1.3(jQuery 1.3 的向后兼容性插件(与 jQuery 1.4 一起使用))
jquery-migrate(将旧版 jQuery 代码迁移到 jQuery 3.0+)
参考
jQuery 博客
jQuery Wiki:不会修复
jQuery 核心升级指南
jQuery Migrate 插件 - 警告消息 (2.0)< /a>
jQuery Migrate 插件 - 警告消息 ( 3.0)
jqLint
jQuery has produced backwards compatibility plugins since version 1.0.
The project has the following backwards compatibility repos:
jquery-compat-1.0(Compatibility plugin for those upgrading to jQuery 1.1+ from jQuery 1.0)
jquery-compat-1.1(Compatibility plugin for those upgrading to jQuery 1.2+ from jQuery 1.1)
jquery-xpath(Implement XPath functionality for those upgrading to jQuery 1.2 from jQuery 1.1)
jquery-compat-1.3(Backwards compatibility plugin for jQuery 1.3 (to be used with jQuery 1.4))
jquery-migrate-1.x-stable(Migrate older jQuery code to jQuery 1.9+)
jquery-migrate(Migrate older jQuery code to jQuery 3.0+)
References
jQuery Blog
jQuery Wiki: Won't Fix
jQuery Core Upgrade Guides
jQuery Migrate Plugin - Warning Messages (2.0)
jQuery Migrate Plugin - Warning Messages (3.0)
jqLint
根据我的经验,jQuery 1.x 在 1.9 版之前一直非常向后兼容。
在您确定这对您来说不是问题之前,不要升级到 2.0:
In my experience, jQuery 1.x has been very backwards-compatible until version 1.9.
And don't upgrade to 2.0 until you're sure that this isn't an issue for you: