Opened 13 years ago
Closed 11 years ago
#7596 closed bug (fixed)
xpath selector attribute name with brackets [] fails
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | selector | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
I can't select an input which name attribute has [] inside. In normal javascript, it is posible. This works:
document.forms[0]entityOV.arrayOVs[0].dProperty?.value
But in JQuery fails on IE6.0, IE7.0, FF3.0. $("input[name='entityOV.arrayOVs[0].dProperty']").val() and works OK on Chrome 7.0.517.44, FF3.5, IE8.
In this link you can run it online: http://jsfiddle.net/XP34r/
Change History (20)
comment:1 Changed 13 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 13 years ago by
Component: | unfiled → selector |
---|---|
Priority: | undecided → high |
Status: | new → open |
comment:3 Changed 12 years ago by
I can reproduce it on FF 3.6.12 and Chrome 8.0.552.210 beta on Ubuntu:
<select name="event[maschine_id]"></select> <script type="text/javascript" > $(function(){ s = $('select[name=event[maschine_id]]'); s.remove(); //does not work in jQuery 1.4.4 but works on 1.4.2 }); </script>
comment:4 Changed 12 years ago by
I have made a testcase:http://jsfiddle.net/FqTuK/
Please Run with jQuery 1.4.4 and jQuery 1.4.3
comment:6 Changed 12 years ago by
comment:7 Changed 12 years ago by
comment:8 Changed 12 years ago by
Milestone: | 1.5 → 1.4.5 |
---|---|
Resolution: | → duplicate |
Status: | open → closed |
In jQuery 1.4.4 the quoting of the attribute value in an attribute selector is mandatory (check on api.jquery.com). And when adding quotes all of the test you posted work.
There is a ticket open for variation where the attribute value is unquoted but all offending meta-characters are escaped.
comment:10 Changed 12 years ago by
This ticket is not a exactly duplicate of #7539.
This is about IE6-7, FF3.0. And the other affects IE8.
comment:11 Changed 12 years ago by
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:12 Changed 12 years ago by
Status: | reopened → open |
---|
@anonymous thanks. Nice catch. Looks like I got distracted by the comments zevero made on this ticket which where more related to #7539 .
To get to the bottom of this I made a new reduced test case
As I originally already had determined in my first comment to this report
I can reproduce this only with browsers which don't support qSA (e.g. IE6/7) so I guess it's a Sizzle problem.
And this holds true. The error is caused by a bad regex match in Sizzle on this line where the CLASS
regex incorrectly matches.
comment:14 follow-up: 15 Changed 12 years ago by
I think this is related - http://jsfiddle.net/v6yJw/ in latest Safari on Mac.
comment:15 follow-up: 16 Changed 12 years ago by
Replying to anonymous:
I think this is related - http://jsfiddle.net/v6yJw/ in latest Safari on Mac.
Forgot to include my email, and to note that in jQuery 1.2.6 it passes, but as of 1.3.2 it fails.
comment:16 Changed 12 years ago by
Replying to ljharb@…:
Replying to anonymous:
I think this is related - http://jsfiddle.net/v6yJw/ in latest Safari on Mac.
Forgot to include my email, and to note that in jQuery 1.2.6 it passes, but as of 1.3.2 it fails.
Never mind that JSFiddle test - I reread http://api.jquery.com/attribute-contains-word-selector/ and apparently ~= requires that the word be delimited by whitespace, and I'm thinking of *=.
comment:20 Changed 11 years ago by
Milestone: | 1.next → 1.8 |
---|---|
Resolution: | → fixed |
Status: | open → closed |
Updated test case
Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a testcase!
I can reproduce this only with browsers which don't support qSA (e.g. IE6/7) so I guess it's a Sizzle problem.