1

Possible Duplicate:
How good is Jquery's Backward Compatibility?

I am developing and administering for a while a shopping site.

As we started it we went with jQuery, which was then version 1.2.6 and didn't see the need for an upgrade until recently.

I am getting errors now, due to some change I can't disclose here due to a NDA, and want to try my luck with a more recent version, namely the 1.7.x

Is it completely backwards compatible, is there a guide to migration from older versions somewhere?

Or better, can someone note possible problem spots?

Edit: Just to state the obvious, I tried the 1.7 already on the staging area. The not-so-obvious part: the errors are gone, and I want to test further, but testing time is precious (and unpaid, needless to say), so I am asking you guys.

4
  • 2
    @AnthonyGrist it's not a duplicate, since that question is old and the answers out-dated.
    – Alnitak
    Commented Jul 2, 2012 at 13:44
  • There is no simple solution or easy answer. You must do the work, check every plugin for compatibility, go through the jQuery release notes and check your custom jQuery code line by line. Otherwise, just upgrade and test everything thoroughly. Whatever you decide, you'll still have to troubleshoot and fix any JavaScript errors.
    – Sparky
    Commented Jul 2, 2012 at 13:49
  • 1
    @Alnitak The question I marked as a possible duplicate is newer than the version of jQuery he's upgrading from. The only valid point is that the information may be outdated, though I think the accepted answer on that question addresses the main point of this question - how good is jQuery's backwards compatibility? Commented Jul 2, 2012 at 13:52
  • 2
    @AnthonyGrist the relevant date would be the release of the version he's upgrading to, and the current answer is "not as good as it used to be" !
    – Alnitak
    Commented Jul 2, 2012 at 13:54

5 Answers 5

3

The most significant backwards incompatibility was the introduction of .prop in 1.6.x which broke some uses of .attr 1

I've been using jQuery extensively since 1.4 (albeit not as far as your 1.2) and don't recall any other changes that actually broke code.

There are also some features that are deprecated, but not necessarily removed yet (see http://api.jquery.com/category/deprecated/).

The jQuery team have also already announced plans for things they plan to deprecate in 1.8, and potentially remove altogether in 1.9 (e.g. $.browser)


1 some people were using .attr to access some data which are strictly properties of a DOM object, whereas .attr is supposed to reflect the actual element as downloaded from the server. For example, .attr('checked') tells you whether a checkbox was initially checked, whereas .prop('checked') tells you whether it's currently checked.

1
  • 1
    It's worth mentioning that since 1.6.1, .attr() includes the property fallback again so only 1.6.0 was breaking things. Commented Jul 2, 2012 at 14:38
1

Well, jQuery is not completely backwards compatible: perhaps you'll find the similar discussion helpful. I'd say that move is definitely worth it, if your JS-codebase already has shown errors.

0

Generally it is easier to upgrade jquery than use new code with older versions, because most of the old functions or behaviors just get deprecated but not removed. It is recommendable to stay up to date, because there are more security issues in older versions, too. But in any case, you have to expect errors...

0

Drupal 6 provides jQuery 1.2 out of the box, and the jQuery Update module only goes up to jQuery 1.3, because some stuff was broken otherwise.

You should really test on your environment, no one can answer you.

-4

You should update jQuery, since the higher the version number, the less bugs in it, and faster it is.

But it can cause problems I think. Some plugins won't work with certain versions, for example.

5
  • 1
    Higher version number doesn't necessarily mean less bugs; if the newer version has new features or functions, it could well introduce more bugs than it fixed. Commented Jul 2, 2012 at 13:33
  • That's what beta-versions are for I guess, but you are right. Anyway I still encourages keeping websites up-to-date with -let's say- the latest safe release.
    – ZeeCoder
    Commented Jul 2, 2012 at 13:37
  • Well, that is what I am attempting right now. The problem is, I cannot afford any problems when this goes live.
    – Bora
    Commented Jul 2, 2012 at 13:39
  • You should use something like: only use jQuery 1.7 when the GET var 'v'=="on" or something. Like this only you would use the page with the new version, for testing purposes. Or if you want to be absolutely certain, you can search for every command's possible compatibility issue, but that's really a lots of work to do. O.o
    – ZeeCoder
    Commented Jul 2, 2012 at 13:43
  • 1
    So you are seriously suggestion to test something like this on a production system? On a development system you could simply update jQuery and test - no need for odd GET variables to select the jQuery version. Commented Jul 2, 2012 at 14:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.