How well does jQuery support backward compatibility?

♀尐吖头ヾ 提交于 2020-01-08 21:51:32

问题


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?


回答1:


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).




回答2:


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.




回答3:


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:

Backward compatibility may not be the jQuery team’s strong suit, but as with most things, it’s a work in progress. I’m not meaning to disparage the great work they do, but it points out the fact that you simply must always test your scripts with new versions of jQuery.




回答4:


In my experience, jQuery 1.x has been very backwards-compatible until version 1.9.

The jQuery 1.x line had major changes as of jQuery 1.9.0. We strongly recommend that you also use the jQuery Migrate plugin if you are upgrading from pre-1.9 versions of jQuery or need to use plugins that haven't yet been updated. Read the jQuery 1.9 Upgrade Guide and the jQuery 1.9 release blog post for more information.

And don't upgrade to 2.0 until you're sure that this isn't an issue for you:

jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8.




回答5:


jQuery has produced backwards compatibility plugins since version 1.0.

Web development has changed a lot over the years, and jQuery has changed along with it. Through all of this time, the team has tried to walk the line between maintaining compatibility with code from the past versus supporting the best web development practices of the present.

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



来源:https://stackoverflow.com/questions/281438/how-well-does-jquery-support-backward-compatibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!