Issues switching from jQuery 1.4.4 to 1.6.1
Should there be any ma开发者_如何学Gojor issues to switch from jQuery 1.4.4 to jQuery 1.6.1?
I just noticed that all of the sites on our system were using 1.4.4.
So should i switch them all over to the newest one (1.6.1) or keep them as is, and if i do switch, what issues may I face?
Your safest bet is to go the jQuery Blog and go though the change logs from 1.4.4 to 1.6.1. Change logs call out feature changes that would require you to change your code.
Here's a sample:
http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/
You might have issues with attr
. Prior to jQuery 1.6 attr("checked")
returned a boolean, now on 1.6+ it returns the attribute value. To get the boolean value you have to use .prop (added on 1.6)
.
On jQuery's blog about 1.6.1 release you will find information to upgrade from 1.5.2 to 1.6.1. This post also tells you a lot of details about .prop
and .attr
. You will also find the full change log.
Both 1.5.1 release post and 1.5.2 release post doesn't present any information on upgrading, which might mean that there is no big changes to be done, but you have the complete list of changes for these versions that you might want to check guarantee.
See
- jQuery 1.6.1 release notes
- jQuery 1.5.2 release notes
- jQuery 1.5.1 release notes
- javascript - .prop() vs .attr()
- jQuery .prop
Description: Get the value of a property for the first element in the set of matched elements.
It depends on what you use. I personally have had no issues when upgrading since 1.3. Best bet would be to look over the release notes, and see if anything you've used was impacted.
Either way if you decide to try it, test, test, test.
EDIT
One thing I forgot. I did have issues with $.ajax switching to using jsonp for json datatypes. But I think that got fixed in a later version.
Hi I've seen this page http://www.davidtong.me/upgrading-jquery-from-1-4-x-to-1-6-1/ that seems to outline the main issues:
prop() and attr()
Ajax and parseJSON
getAttribute on Flash objects
Plugins
精彩评论