Ticket #7596 (closed bug: fixed)
xpath selector attribute name with brackets [] fails
| Reported by: | jcctmg@… | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.8 |
| Component: | selector | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description (last modified by rwaldron) (diff)
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
comment:2 Changed 3 years ago by jitter
- Priority changed from undecided to high
- Status changed from new to open
- Component changed from unfiled to selector
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.
comment:3 Changed 3 years ago by zevero
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 3 years ago by zevero
I have made a testcase: http://jsfiddle.net/FqTuK/
Please Run with jQuery 1.4.4 and jQuery 1.4.3
comment:8 Changed 3 years ago by jitter
- Status changed from open to closed
- Resolution set to duplicate
- Milestone changed from 1.5 to 1.4.5
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 3 years ago by anonymous
This ticket is not a exactly duplicate of #7539.
This is about IE6-7, FF3.0. And the other affects IE8.
comment:11 Changed 3 years ago by jitter
- Status changed from closed to reopened
- Resolution duplicate deleted
comment:12 Changed 3 years ago by jitter
- Status changed from reopened to 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:13 Changed 3 years ago by jitter
#7741 is a duplicate of this ticket.
comment:14 follow-up: ↓ 15 Changed 2 years ago by anonymous
I think this is related - http://jsfiddle.net/v6yJw/ in latest Safari on Mac.
comment:15 in reply to: ↑ 14 ; follow-up: ↓ 16 Changed 2 years ago by 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.
comment:16 in reply to: ↑ 15 Changed 2 years ago by ljharb@…
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:17 Changed 2 years ago by jitter
#8260 is a duplicate of this ticket.
comment:18 Changed 2 years ago by john
#9014 is a duplicate of this ticket.
comment:19 Changed 2 years ago by john
Confirmed in bug triage.
comment:20 Changed 12 months ago by timmywil
- Status changed from open to closed
- Resolution set to fixed
- Milestone changed from 1.next to 1.8
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
