Opened 7 years ago

Closed 4 years ago

#15580 closed defect (patchwelcome)

dojo.query not return correct results when custom attribute contains '=' or ','

Reported by: zhuxw Owned by: Kris Zyp
Priority: undecided Milestone: 1.13
Component: Query Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Given a dom structure like this:

<div id='container'>

<div myattr="a=b">

<div>1</div>

</div> <div myattr="cd">

<div>2</div>

</div>

</div>

Then the following query should return the <div> containing 1:

dojo.query("[myattr='a=b'] div", "container"); return []

But it returns an empty array.

But if removing the root node "container", it works fine:

dojo.query("[myattr='a=b'] div"); correct

Same thing appears if myattr='a,b'.

Change History (2)

comment:1 Changed 7 years ago by Paul Christopher

It think = is not a valid character for ids/ class names, see http://www.w3.org/TR/CSS21/syndata.html#characters

The relevant paragraph says:

"In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F"."

comment:2 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 3+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.