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...
Think I Found Important Bug in jQuery 1.3
Moderator: General Moderators
-
jack_indigo
- Forum Contributor
- Posts: 186
- Joined: Sun Jun 08, 2008 11:25 pm
Re: Think I Found Important Bug in jQuery 1.3
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
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.
I think they're going to close that bug report.
- 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
It's a HTML ID, not JavaScript. Same goes with many XML attributes too.jack_indigo wrote:I also didn't realize that you can't make an ID in Javascript start with a non letter.