Think I Found Important Bug in jQuery 1.3

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jack_indigo
Forum Contributor
Posts: 186
Joined: Sun Jun 08, 2008 11:25 pm

Think I Found Important Bug in jQuery 1.3

Post by jack_indigo »

I think I found an important bug this morning in jQuery 1.3. The selector by attribute technique like:

Let's say I have a DIV id=something and inside there's a hyperlink with id=43332, and I want to use the following code to hide it:

$('#something A[@id=43332]').hide();

This used to work with 1.2.6. But not with 1.3. Instead, I get a syntax error that the item cannot be found.

So, I removed the #something out to test, and again, the same error.

I switched back to jQuery 1.2.6 and the problem was resolved.

...Now off to the jQuery bug report site...
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Think I Found Important Bug in jQuery 1.3

Post by pickle »

A number of things:
  • I think 1.3 did away with using the '@'. I'm not sure if its deprecated or completely gone though.
  • I'm not sure if there's case sensitivity
  • Have you tried validating that page? You can't have an element's id start with a digit.
  • Bug or not, your selector isn't very efficient. IDs are supposed to be unique in the page, so why are you restricting the scope by checking inside #something? You should be able to just use '#a43332' (note I put the 'a' in there). No need to check the id attribute like you have
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
jack_indigo
Forum Contributor
Posts: 186
Joined: Sun Jun 08, 2008 11:25 pm

Re: Think I Found Important Bug in jQuery 1.3

Post by jack_indigo »

Pickle: You're right. Didn't realize it -- they did away with the @. I also didn't realize that you can't make an ID in Javascript start with a non letter. Thanks for those tips.

I think they're going to close that bug report.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: Think I Found Important Bug in jQuery 1.3

Post by jayshields »

jack_indigo wrote:I also didn't realize that you can't make an ID in Javascript start with a non letter.
It's a HTML ID, not JavaScript. Same goes with many XML attributes too.
Post Reply