Page 1 of 1

Think I Found Important Bug in jQuery 1.3

Posted: Tue Jan 20, 2009 4:24 am
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...

Re: Think I Found Important Bug in jQuery 1.3

Posted: Tue Jan 20, 2009 10:40 am
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

Re: Think I Found Important Bug in jQuery 1.3

Posted: Tue Jan 20, 2009 12:21 pm
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.

Re: Think I Found Important Bug in jQuery 1.3

Posted: Tue Jan 20, 2009 1:08 pm
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.