Opened 13 years ago

Closed 10 years ago

#9193 closed defect (fixed)

dojo.query fails to recognize attributes having certain kinds of brackets in their values

Reported by: ptwobrussell Owned by: dylan
Priority: high Milestone: 1.8
Component: Query Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:


If you have an attribute value that contains square brackets, dojo.query fails to match on it. Example: <input name="data[foo][bar]"> wont match with a selector of dojo.query("input[name=data[foo][bar]]"). I totally realize this is an edge case, but it did come up in production work. (CakePHP (no, don't worry, I'm not using it by choice), in particular, likes form fields to be named like data[X], so that's how it came up. Maybe there are others out there too.)

Tried this with 1.3.0.

Change History (12)

comment:1 Changed 13 years ago by bill

Component: CoreQuery
Owner: changed from anonymous to alex

comment:2 Changed 13 years ago by James Burke

With latest trunk code, using this type of query (adding escape characters to the query):


works in FF 3.5, Safari 4, Chrome 3, Opera 10 and IE 8.

However IE 7 fails, and I expect IE6 might also.

comment:3 Changed 13 years ago by James Burke

Milestone: tbdfuture

comment:4 Changed 12 years ago by Thomas Bachem

Works perfectly for me, you just have to use proper CSS selector escaping:


comment:5 Changed 11 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:6 Changed 10 years ago by ben hockey

Resolution: duplicate
Status: newclosed

Duplicate of #7479.
2 reports of success and #7479 sounds similar so closing this ticket as a duplicate of 7479

comment:7 Changed 10 years ago by bill

In [27956]:

test case for attributes with brackets (it's working, refs #9193.

comment:8 Changed 10 years ago by bill

Resolution: duplicate
Status: closedreopened

Like thomasbachem said, I think this was never a bug, just a user error. His test above works for me even in 1.3.

comment:9 Changed 10 years ago by bill

Resolution: invalid
Status: reopenedclosed

comment:10 Changed 10 years ago by bill

In [27961]:

Check in fix from James for attribute values with dots and backslashes. Refs #9193, fixes #11189 !strict.

comment:11 Changed 10 years ago by bill

Resolution: invalid
Status: closedreopened

comment:12 Changed 10 years ago by bill

Milestone: future1.8
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.