Skip to main content

Bug Tracker

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:
Component: core Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

I posted a ticket but it was rejected as a sapn. So I write it my blog and link it.

jQuery Result:

Attachments (0)
Change History (7)

Changed July 07, 2011 10:25PM UTC by miya2000 comment:1

Changed July 07, 2011 10:52PM UTC by rwaldron comment:2

owner: → miya2000
status: newpending

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 rwaldron comment:3

Reduced test case:

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 miya2000 comment:4

status: pendingnew

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:

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 rwaldron comment:5

component: unfiledcore
owner: miya2000rwaldron
priority: undecidedhigh
status: newassigned

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 rwaldron comment:6

resolution: → duplicate
status: assignedclosed

Closing as duplicate, however this is not a 1-to-1 duplicate, simply that fixing 9521 will also resolve this issue

Changed July 12, 2011 04:00PM UTC by rwaldron comment:7

Duplicate of #9521.