2

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

RisingSun
  • 1,693
  • 27
  • 45
  • Any console errors, or ideas? – danronmoon Jan 30 '13 at 01:19
  • 1
    Here is a link to the [jQuery Migrate Information](http://jquery.com/upgrade-guide/1.9/#jquery-migrate-plugin) – ROY Finley Jan 30 '13 at 01:19
  • When I change the jQuery version to 1.9 it says "Uncaught TypeError: Cannot read property 'msie' of undefined " – RisingSun Jan 30 '13 at 01:21
  • 1
    jQuery.browser has been removed in 1.9. You're going to have to download jQuery migrate plugin. – danronmoon Jan 30 '13 at 01:23
  • I was reading the docs of the migrate plugin at it says "The plugin can be included with versions of jQuery as old as 1.6.4 as a migration tool to identify potential upgrade issues." Will that be an issue? My version is 1.6.2 – RisingSun Jan 30 '13 at 01:25
  • If you're sticking with 1.6.2, then you have no problem and don't need the plugin to get $.browser. If you're going to 1.9, you should get the plugin. – danronmoon Jan 30 '13 at 01:30
  • What I am trying to ask is that the docs says "as old as 1.6.4" but the version the plugin uses is 1.6.2. Will the migrate plugin work with 1.6.2? I'm asking because I dont know how much difference there is between 1.6.2 and 1.6.4. – RisingSun Jan 30 '13 at 01:33
  • It's a tool used for issues when you upgrade. If you don't upgrade, then you have no problem. There's no point in using the migrate plugin. You said that CropZoom works well with 1.6.2. If it ain't broke, don't fix it! 1.9 has methods removed, so you'd need the plugin to use those methods again. – danronmoon Jan 30 '13 at 01:36

2 Answers2

6

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.
ROY Finley
  • 1,406
  • 1
  • 9
  • 18
  • Thanks for the help. I really appreciate it. I tried out the plugin and it works perfect with 1.9. Right know I am replacing the old deprecated/removed codes. One thing the plugin does is checks if the browser is IE using browser.msie and if it is it uses a different css to transform an image than other browsers. I haven't found an easy way to do that check. In the meantime, I am checking if tbody is inserted automatically. Apparently IE does that. – RisingSun Jan 30 '13 at 02:41
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>