Side navigation
#9776 closed bug (duplicate)
Opened July 07, 2011 02:30PM UTC
Closed July 12, 2011 04:00PM UTC
Last modified July 12, 2011 04:00PM UTC
jQuery can't select elements by completely valid CSS selector and alternatively makes unwished DOM element
Reported by: | miya2000 | Owned by: | rwaldron |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | core | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I posted a ticket but it was rejected as a sapn. So I write it my blog and link it.
http://d.hatena.ne.jp/miya2000/20110707/p0
jQuery Result:
Attachments (0)
Change History (7)
Changed July 07, 2011 10:25PM UTC by comment:1
Changed July 07, 2011 10:52PM UTC by comment:2
owner: | → miya2000 |
---|---|
status: | new → pending |
Is there anyway you could reduce that overkill to something simple and straight forward that merely illustrates the issue...?
Changed July 07, 2011 11:02PM UTC by comment:3
Reduced test case:
http://jsfiddle.net/rwaldron/wFJ8N/
FWIW, I think it's obscene that HTML5 puts no restrictions on the characters that can be used in attribute values
Changed July 09, 2011 02:29AM UTC by comment:4
status: | pending → new |
---|
Thanks a lot! I didn't know that Firebug Lite is available. It is very simple!
FWIW, I think it's obscene that HTML5 puts no restrictions on the characters that can be used in attribute values
I think so, too about "class" attribute.
But attributes are not only "class". "value" and "data-*" attributes are expected to store any data.
And it is possible to include every attributes in a query selector.
And jQuery document says:
http://api.jquery.com/category/selectors/
If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\\\.
So I think it should be fixed.
This problem is caused by existing two context, "Selector" and "DOM creation", in a same signature $(string).
I think jQuery's main work is Selector. But DOM creation interrupts it.
Fortunately, There is no selector starts with '<'.
So I agree with suggestion in #9521.
Do you think it has any problem in this suggestion?
Thank you.
Changed July 09, 2011 02:39AM UTC by comment:5
component: | unfiled → core |
---|---|
owner: | miya2000 → rwaldron |
priority: | undecided → high |
status: | new → assigned |
First of all, I think you misunderstood me - I said nothing about "class" attributes specifically; I meant _all_ attributes. It has nothing to do with the sizzle/selectors, but everything to do with the regular expression used to determine which branch of logic should be used.
Changed July 12, 2011 04:00PM UTC by comment:6
resolution: | → duplicate |
---|---|
status: | assigned → closed |
Closing as duplicate, however this is not a 1-to-1 duplicate, simply that fixing 9521 will also resolve this issue
Solution -> Ticket #9521 http://bugs.jquery.com/ticket/9521#comment:3