Bug Tracker

Modify

Ticket #8229 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

jquery selecter not compatible with

Reported by: fifsky@… Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

old jquery 1.4.2 $("#foo").find('input[name=test[]]'); is right; new jquery 1.5.0 is error must $("#foo").find("input[name='test[]']"); More rigorous, but cannot and front version compatible

Change History

comment:1 follow-up: ↓ 2 Changed 2 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to selector

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

As you didn't provide the test case required by the  bug reporting guidelines I went ahead and made this one myself  http://jsfiddle.net/jitter/njF8R/ . As you can see input[name=test[]] isn't a valid CSS selector and neither is it a valid selector in jQuery (if this worked in an earlier version then it was actually a bug that got fixed). So you should fix your code to use a valid selector.

The documentation is also pretty clear about these kind of selectors:

 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

 http://api.jquery.com/category/selectors/attribute-selectors/

Attribute values in selector expressions must be surrounded by quotation marks.

 http://api.jquery.com/attribute-equals-selector/

Quotes are mandatory.

Basically a dupe of #8120

Last edited 2 years ago by jitter (previous) (diff)

comment:2 in reply to: ↑ 1 Changed 2 years ago by fifsky@…

Replying to jitter:

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

As you didn't provide the test case required by the  bug reporting guidelines I went ahead and made this one myself  http://jsfiddle.net/jitter/njF8R/ . As you can see input[name=test[]] isn't a valid CSS selector and neither is it a valid selector in jQuery (if this worked in an earlier version then it was actually a bug that got fixed). So you should fix your code to use a valid selector.

The documentation is also pretty clear about these kind of selectors:

 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

 http://api.jquery.com/category/selectors/attribute-selectors/

Attribute values in selector expressions must be surrounded by quotation marks.

 http://api.jquery.com/attribute-equals-selector/

Quotes are mandatory.

Basically a dupe of #8120

Thank your answer!O(∩_∩)O~

comment:3 Changed 2 years ago by jitter

#8246 is a duplicate of this ticket.

comment:4 Changed 2 years ago by jitter

#8282 is a duplicate of this ticket.

comment:5 Changed 2 years ago by jitter

#8309 is a duplicate of this ticket.

comment:6 Changed 2 years ago by jitter

#8351 is a duplicate of this ticket.

comment:7 Changed 2 years ago by rwaldron

#8410 is a duplicate of this ticket.

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.