Bug Tracker

Modify

Ticket #7445 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

attribute selector not support attribute name with '$'

Reported by: jiajw0426@… Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocking: Blocked by:

Description

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

comment:1 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to invalid

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 3 years ago by anonymous

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

comment:3 Changed 3 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 3 years ago by jiajw0426@…

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 3 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?

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.