views:

1526

answers:

11

I hear nothing but great things about the newest version of jQuery 1.3. Has anyone experienced any problems upgrading from 1.2.6? I would love to use it but I want to know if there are any gotchas first.

EDIT: 1.3.1 is out.

A: 

I am using 1.2.6 and it's working fine for me. I didn't know that Jquery 1.3 was released. Just checking it out and it sounds very exciting. Thanks for the information.

Edit: I just upgraded my existing 1.2.6 based project to 1.3 and it runs fine without any problems.

Cyril Gupta
+9  A: 

I've upgraded to the latest version with relative ease. Most of the major issues are detailed in the Release Notes.

I had one small issue that was not covered in the release notes; however, it was solved by Matthew Crumley and Jimmy P in the comments of my answer.

Tom
The [attribute!="value"] selector changed in 1.3. In your case, it would only match images that have a class, but it's not "loader"; it won't match images with no class. That could be the problem. Here's the documentation for the new version: http://docs.jquery.com/Selectors/attributeNotEqual
Matthew Crumley
You could just use img:not(.loader)
J-P
@Matthew Crumley, @JimmyP - Thanks guys. I didn't really ask a question and still got some helpful answers. That's awesome =)
Tom
+1  A: 

jQuery 1.3 open tickets will help (Requires Register/Login)
Also check the jquery dev google group

redsquare
+1  A: 

When I tried to upgrade it broke drag and drop using jQuery UI for me.

brian
Did you upgrade jQuery UI as well? It was updated to support the new jQuery version.
R. Bemrose
I had the same problem, and yes, we did upgrade UI as well.
Prestaul
A: 

The only problems I've had with jQuery 1.3 have been selector issues (i.e. Sizzle). For example, this doesn't work with 1.3, it actually crashes Firefox:

$('ul:not('.whatever') a');

John [Resig] says he's looking into it though (http://groups.google.com/group/sizzlejs/browse_thread/thread/209f4e8c9b65d742).

I believe jQuery, with its latest release, no longer supports xPath selectors either. So you can't do this: [@name=whatever]...

J-P
Maybe you should try $("ul:not('.whatever') a"); The nested single quotes is a syntax error.
Daniel Beardsley
@name= syntax was changed to just name= according to the release notes.
R. Bemrose
you dont need the inner quotes
redsquare
Not valid js let alone a valid selector. Use $("ul:not(.whatever) a").
Prestaul
+4  A: 

The only gotchas that might occur are with the plug ins you are using. If the plug in developers have code that was dependent on deprecated methods then you'll need to wait till they are also updated before updating jQuery.

RedWolves
Specifically, older versions of jQuery UI are not supported. You have to use the latest release candidate.
Andrew Hedges
+1  A: 

I had a problem with a selector matching <select> tags, such as

$('.size select')

For some reason it is no longer matching the <select> tag, but it's <option> tags instead. Navigating to the parent node solved the issue for me, but it's more like an ugly hack rather than expected behavior.

$('.size select').parent()

Anybody else noticed this problem?

haven't noticed the issue, but agree it's a bug.submit a ticket for the issue http://dev.jquery.com/report. maybe it's been logged and assigned already.
CVertex
Shouln't it be $(".size option").slice(0,1).parent() instead, that way your code won't stop working when the bug is fixed.
svinto
+1  A: 

The :not pseudo selector is broken for Firefox and Internet Explorer (still works on Webkit) - it will put your browser into an infinite loop.

The workaround until it is fixed is to change your code:

// OLD:
$("a:not(.faq)")
// NEW:
$("a").not(".faq")

// OLD:
$(".menu li:not(.parent) a")
// NEW:
$(".menu li").not(".parent").find("a")

this is covered in Ticket #3837 which is marked as fixed, but hasn't made its way into the release.

nickf
A: 

jQuery 1.3.1 is out.

Craig Stuntz
+1  A: 

I upgraded from 1.2.6 to 1.3.1 and this stopped working:

$("input[type=text][value='']").css("background-color", "red");

Failed in Firefox 3 with the error

[Exception... "'Syntax error, unrecognized expression: value='']' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "" data: no]

Line 0

benrwb
A: 

I am upgrading a fairly heavy ajax site from 1.2.6 to 3.1 and have had only one issue so far. Within an each I was looking up attributes of an xml element and had to call toString() on the object in the loop. For example:

var items = ['foo','bar'];
var task = data.find("task");
items.each(function() {
  var thingName = this;
  var thingValue = task.attr(thingName<.toString() was added here but had been fine in 1.2.6>);
});

I was getting an error about invalid character (NS_ERROR_DOM_INVALID_CHARACTER_ERR) before forcing the object to be a string. Note that this was working in version 1.2.6 and represents a possible upgrade issue.