Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#13658 closed defect (fixed)

dojo.query $= returns incorrect elements

Reported by: CraigMorgan Owned by: Kris Zyp
Priority: high Milestone: 1.7.5
Component: Query Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:


This bug is occuring for me in IE9, but I believe it will be reproducible in all browsers without QSA (querySelectorAll) functionality available.
In case the above link fails, here's the example:


dojo.ready(function() {
  var nodeList = dojo.query("div[id$='55555']", dojo.byId('other'));
  nodeList .forEach(function(node) {
    console.log("result: ", node.outerHTML);
  console.log("nodeList: ", nodeList);


<div id='other'>
  <div id='abc55555'></div>
  <div id='abd55555efg'></div>
  <div id='55555abc'</div>
  <div id='1'></div>
  <div id='2c'></div>
  <div id='3ch'></div>
  <div id='4chr'></div>
  <div id='5char'></div>
  <div id='6chars'></div>

The above example should only output <div id='abc55555'></div> to console. Instead, it also outputs <div id='3ch'></div>.

The bug is in the line "return (ea.lastIndexOf(value)==(ea.length-value.length));", which can be found on line 452 of query.js .

Change History (7)

comment:1 Changed 11 years ago by CraigMorgan

Sorry about the summary, I forgot to finish it. It should be something like "dojo.query $= returns incorrect elements", but I can't see how to change it now.

comment:2 Changed 11 years ago by bill

Component: GeneralQuery
Owner: set to Kris Zyp
Summary: dojo.query '$='dojo.query $= returns incorrect elements

comment:3 Changed 10 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

In [27534]:

Fix $= query handling, fixes #13658 !strict

comment:4 Changed 10 years ago by bill

Milestone: tbd1.8

comment:5 Changed 10 years ago by bill

#9497 is a duplicate of this ticket.

comment:6 Changed 10 years ago by Colin Snover

In [30041]:

Fix $= query handling, fixes #13658 !strict Backport to 1.7

comment:7 Changed 10 years ago by Colin Snover

Note: See TracTickets for help on using tickets.