Skip to main content

Bug Tracker

Side navigation

#8229 closed bug (invalid)

Opened February 10, 2011 09:42AM UTC

Closed February 10, 2011 01:27PM UTC

Last modified March 30, 2011 05:23PM UTC

jquery selecter not compatible with

Reported by: fifsky@gmail.com Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
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

Attachments (0)
Change History (7)

Changed February 10, 2011 01:27PM UTC by jitter comment:1

_comment0: 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 [http://docs.jquery.com/How_to_Report_Bugs 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.1297344530945654
component: unfiledselector
priority: undecidedlow
resolution: → invalid
status: newclosed

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

Changed February 11, 2011 01:31AM UTC by fifsky@gmail.com comment:2

Replying to [comment:1 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~

Changed February 11, 2011 01:58PM UTC by jitter comment:3

#8246 is a duplicate of this ticket.

Changed February 15, 2011 03:59PM UTC by jitter comment:4

#8282 is a duplicate of this ticket.

Changed February 19, 2011 12:31AM UTC by jitter comment:5

#8309 is a duplicate of this ticket.

Changed February 22, 2011 11:07PM UTC by jitter comment:6

#8351 is a duplicate of this ticket.

Changed March 30, 2011 05:23PM UTC by rwaldron comment:7

#8410 is a duplicate of this ticket.