Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7445 closed bug (invalid)

attribute selector not support attribute name with '$'

Reported by: [email protected] Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:


I did get the result i wanted when i using selector 'p[
$sw="sw"] 。 i found at line 3606 of jquery.js the code "var name = match[1]" ,must be"var name = match[1].replace(/
/g, "")",like at line 3404.

Change History (5)

comment:1 Changed 12 years ago by snover

Resolution: invalid
Status: newclosed

Thanks for the report but this is not a jQuery bug. $sw is not valid in the name part of a CSS attribute selector. You must escape the $. In the future, please use the jQuery Forum for support requests.

comment:2 Changed 12 years ago by anonymous

i have escape the $ with two backslash,you can see in the bug Description.

comment:3 Changed 12 years ago by jitter

It looks like the reporter forgot to escape the double backslash. As \\ means line break in Trac formatting. So I guess where the linebreaks are the reporter typed \\.

What I don't understand is what the reporter actually reports. The selector documentation explicitly states that you need to double-escape the meta characters in the documentation.

test case that shows we can select by attributes named $sw and that the escaping works as required/documented

comment:4 Changed 12 years ago by [email protected]

I know the test case can run rightly on google chrome,firefox and ie。but i write the same test case in my computer ,it shows that you can not select by attributes named $sw on ie8.

comment:5 Changed 12 years ago by jitter

When I run the test case I linked to in IE 8 it works as expected. Can you provide a test case on http://jsfiddle.net which doesn't work in IE8?

Note: See TracTickets for help on using tickets.