Side navigation
#7596 closed bug (fixed)
Opened November 22, 2010 05:06PM UTC
Closed July 03, 2012 02:26AM UTC
xpath selector attribute name with brackets [] fails
Reported by: | jcctmg@gmail.com | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | selector | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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:
Attachments (0)
Change History (20)
Changed November 22, 2010 05:49PM UTC by comment:1
description: | {{{ \ \ 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/ \ \ }}} → 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/ \ |
---|
Changed November 22, 2010 06:13PM UTC by comment:2
_comment0: | Updated [http://jsfiddle.net/jitter/LB6u3/ 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 browser which don't support qSA so I guess Sizzle problem. → 1290450184771216 |
---|---|
_comment1: | Updated [http://jsfiddle.net/jitter/LB6u3/ 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 so I guess it's a Sizzle problem. → 1290450295354967 |
component: | unfiled → selector |
priority: | undecided → high |
status: | new → open |
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.
Changed December 01, 2010 03:17PM UTC by comment:3
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>
Changed December 01, 2010 03:30PM UTC by comment:4
I have made a testcase:[http://jsfiddle.net/FqTuK/]
Please Run with jQuery 1.4.4 and jQuery 1.4.3
Changed December 01, 2010 03:43PM UTC by comment:5
Escaping with / or / / does not work either :(
Changed December 01, 2010 03:56PM UTC by comment:6
Changed December 01, 2010 04:15PM UTC by comment:7
Changed December 01, 2010 11:30PM UTC by comment:8
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.
Changed December 06, 2010 10:35AM UTC by comment:10
This ticket is not a exactly duplicate of #7539.
This is about IE6-7, FF3.0. And the other affects IE8.
Changed December 06, 2010 11:24AM UTC by comment:11
resolution: | duplicate |
---|---|
status: | closed → reopened |
Changed December 06, 2010 12:17PM UTC by comment:12
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.
Changed December 09, 2010 09:21PM UTC by comment:13
#7741 is a duplicate of this ticket.
Changed January 14, 2011 11:59PM UTC by comment:14
I think this is related - http://jsfiddle.net/v6yJw/ in latest Safari on Mac.
Changed January 15, 2011 12:05AM UTC by comment:15
Replying to [comment:14 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.
Changed January 19, 2011 11:14PM UTC by comment:16
Replying to [comment:15 ljharb@…]:
Replying to [comment:14 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 *=.
Changed February 13, 2011 07:19PM UTC by comment:17
#8260 is a duplicate of this ticket.
Changed July 12, 2011 04:20PM UTC by comment:18
#9014 is a duplicate of this ticket.
Changed July 12, 2011 04:21PM UTC by comment:19
Confirmed in bug triage.
Changed July 03, 2012 02:26AM UTC by comment:20
milestone: | 1.next → 1.8 |
---|---|
resolution: | → fixed |
status: | open → closed |