Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#11189 closed defect (fixed)

dojo query escape '[' ',' ']' and '.' with \\ don't work for form input field name property

Reported by: davidchen_dojo Owned by: Kris Zyp
Priority: low Milestone: 1.7.5
Component: Query Version: 1.5.0b2
Keywords: query escape needsreview Cc:
Blocked By: Blocking:

Description (last modified by bill)

With a form input field which name is foo[0].bar , this is standard name format generated by struts nested text/hidden tag when iterate list of object.

dojo.query('input[name=foo\\[0\\]\\.bar]');

return empty list.

I tested on 1.5.0b3 and 1.4.2 .

Attachments (1)

11189.patch (606 bytes) - added by James Burke 9 years ago.
Possible patch

Download all attachments as: .zip

Change History (14)

comment:1 Changed 9 years ago by Adam Peller

Milestone: 1.5tbd
Owner: changed from anonymous to James Burke

comment:2 Changed 9 years ago by James Burke

If the name is foo[0] or foo[0]bar then using the backslash escaping allows it to be selected, so it is a failure with the "." part of the name. That triggers the non-QSA branch in Acme, the DOM selector part, and it uses a node.getAttribute() call to compare the attribute values, but the attribute value in the query still has the backslash escapes so there is no match. I did a quick hack for a fix, I'll attach it, but I do not like the regexp hit for attribute selector values. Seems to work though.

Last edited 8 years ago by bill (previous) (diff)

Changed 9 years ago by James Burke

Attachment: 11189.patch added

Possible patch

comment:3 Changed 9 years ago by James Burke

Milestone: tbd1.6

comment:4 Changed 9 years ago by bill

Milestone: 1.6future

(sadly) punting seemingly abandoned ticket and meta tickets to future

comment:5 Changed 8 years ago by Colin Snover

Priority: highblocker

Bulk update of open ticket priorities.

comment:6 Changed 8 years ago by bill

Component: CoreQuery
Owner: changed from James Burke to Kris Zyp
Status: newassigned

Presumably still an issue with acme; not sure about the lite engine.

comment:7 Changed 8 years ago by ben hockey

Priority: blockerlow

comment:8 Changed 8 years ago by ben hockey

Keywords: needsreview added

bill, is this fixed with r27952?

comment:9 Changed 8 years ago by bill

Description: modified (diff)

No, it's not.

According to #9913 the backslahs syntax above is invalid, and it should be something like

dojo.query('input[name="foo[0].bar"]');

Is there somewhere that says backslashes are supported?

But even with quotes it's not working. I'll try James' patch though.

comment:10 Changed 8 years ago by bill

Milestone: future1.8

OK, his patch works to fix the original report of this ticket, although doesn't fix my suggestion above. But anyway I'll checkin.

comment:11 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

In [27961]:

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

comment:11 Changed 7 years ago by Colin Snover

In [30033]:

Backport [29124], [27952], and [27961] to 1.7. According to the original changesets, this fixes #14877, #14876, #10651, #11189. !strict

comment:12 Changed 7 years ago by Colin Snover

Milestone: 1.81.7.5
Note: See TracTickets for help on using tickets.