Differences with jQuery 1.4.2 and 1.7.1?

I create my site in jQuery version 1.4.2 (without understanding any updates), but now it does not work in IE8. When searching for a solution, I thought about updating. When I use jQuery 1.7.1. however, some strange things happen. For example, this example is on jsFiddle

http://jsfiddle.net/64d2T/

When running this example in 1.4.4, it works fine, but when I run the code in 1.7.1, the format is messed up.

Does anyone know this problem and am I doing some basic things wrong?

+4
source share
2 answers

the .add () method seems to work differently ... providing context fixes the problem:

http://jsfiddle.net/64d2T/5/

Replacement:

$(this).find('.news-title-description').add('.news-meta').add('.news-item-link').add('.news-header').addClass('active-news-item'); 

with:

 $(this).find('.news-title-description').add('.news-meta',$(this)).add('.news-item-link',$(this)).add('.news-header',$(this)).addClass('active-news-item'); 
+3
source

It depends on the project to the projects, what you should do when upgrading jQuery:

  • isNumeric () is new, be careful as an earlier version of jQuery.isNaN () is deprecated
  • JqXHR success and error are outdated
  • When rendering content with text (), firewalls with spaces specify spaces.
  • The attr () and prop () methods are not the same and can cause problems when using attr (), and the given values ​​allow you to say:
      $ ("input) .attr (" checked ") 
    which return true to 1.6, now you should use
      $ ("input: checked") 
  • Ajax API has been rewritten in 1.5

It's also a good idea to go through all the release notes and understand the purpose of any changes and make a few notes about what you should check in your project http://docs.jquery.com/Downloading_jQuery#Past_Releases

+7
source

Source: https://habr.com/ru/post/1385097/


All Articles