jQuery 1.9 backward compatibility issue?

前提是你 提交于 2019-12-22 18:29:01

问题


I am trying to use a jQuery plugin on my site which uses jQuery 1.6.2. When I change the jQuery version to 1.9 the plugin no longer works. I thought there was a backwards compatibility feature in jQuery. Is there any way to know/fix the code that does not work in 1.9? If it helps I am trying to use a plugin called CropZoom and here is the link. Also, let me know if there is similar plugin the same features. I'll appreciate it. Thanks


回答1:


This is How jQuery tell's you to fix it:

We realize that existing sites and plugins may be affected by these changes, and are providing the jQuery Migrate plugin for a transitional upgrade path. Individual descriptions below indicate if the behavior changed in 1.9 can be restored by using the jQuery Migrate plugin. Note that all of the changes in jQuery 1.9 will also apply to jQuery 2.0, and the jQuery Migrate plugin will be usable there as well.

The uncompressed development version of the jQuery Migrate plugin includes console log output to warn when specific deprecated and/or removed features are being used. This makes it valuable as a migration debugging tool for finding and remediating issues in existing jQuery code and plugins. It can be used for its diagnostics with versions of jQuery core all the way back to 1.6.4.

The compressed version of the plugin does not generate any log output, and can be used on production sites when jQuery 1.9 or higher is desired but older incompatible jQuery code or plugins must also be used. Ideally this would only be used as a short-term solution, but that's a decision for you to make.

LINK IS HERE

Other Options

  • Check with plugin developer to see if the plugin has been upgraded
  • find a newer version of a plugin with the same or close features
  • Update the plugin code yourself, by replacing depreciated code with relevant replacement code.



回答2:


when you are using jquery-1.9.1,jquery-migrate-1.1.1.min.js should be added for compatiability to previous versions as below

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"></script>


来源:https://stackoverflow.com/questions/14595108/jquery-1-9-backward-compatibility-issue

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