Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#3520 closed defect (fixed)

Dojo.query does not recognise escaped colon characters for CSS selector

Reported by: guest Owned by: alex
Priority: high Milestone:
Component: Query Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


CSS 3 spec insists that ids and other names containing colons may be specified by using : to represent a literal colon character within the name - this is not supported by the dojo query parser, which everywhere detects colon characters for the pseudo-element selector literally by simply looking for index of ":".

For example, the following selector #gallery:::gallery-thumbs::: should detect an element with an id of gallery:::gallery-thumbs::: but it does not.

The escaped usage *does* seem to be supported by the browsers I investigated - for example a CSS rule of #my:id {color: green} sucessfully applied to <h3 id="my:id">My heading</h3>. IDs containing colons are very frequently generated in the rendered markup from various server-side frameworks such as JSF and RSF.

Change History (6)

comment:1 Changed 15 years ago by Adam Peller

Owner: changed from anonymous to alex

comment:2 Changed 15 years ago by bill

Component: GeneralCore

comment:3 Changed 15 years ago by alex

this is mildly problematic given that the selectors need to be represented as JS strings, so any backslash is going to be double-backslashed in order to represent the selector accurately. e.g., this: #my:id is represented in a dojo.query call as: dojo.query("#my\:id") meaning that what you see isn't what you get. As a result, I'm not sure we should fix this bug. What does everyone else think?

comment:4 Changed 15 years ago by bill

I think it's ridiculous that people use (and software generates) ids like "my:bar" when CSS has selectors like "#my:focused". But on the other hand we don't want to stop people from using JSF. I'm sort of on the fence. I guess I would implement support in dojo.query and make people type the \.

comment:5 Changed 15 years ago by alex

Resolution: fixed
Status: newclosed

(In [11210]) allow colons in IDs, names, etc. Fixes #3520

comment:6 Changed 13 years ago by bill

Component: CoreQuery
Note: See TracTickets for help on using tickets.