Opened 10 years ago

Closed 7 years ago

#10029 closed defect (fixed)

NodeList children() and filter() query fails

Reported by: Les Owned by: James Burke
Priority: high Milestone: 1.7
Component: Query Version: 1.3.2
Keywords: dojo.NodeList-traverse Cc: dante, Eugene Lazutkin, alex, Kris Zyp
Blocked By: Blocking:


This might be related to ticket #9665.


dojo.query('form').children(':not(textarea)'); // returns [] <== bad

dojo.query('form').children().filter(':not(textarea)'); // returns [] <== bad

dojo.query('form>*:not(textarea)'); // returns [div.myClass, div.myClass] <== OK

Change History (8)

comment:1 Changed 10 years ago by James Burke

Cc: dante Eugene Lazutkin alex added

I consider this a dupe of #9665, the issue mainly is that children() uses filter() underneath, and filter is limited to very simple selectors. For the second example, using query() instead of filter works:


So the fix for children() is to not use filterQueryResult (which is what filter() uses) and just a query call (what #9665 is tracking). However it will be a slower call.

I wouldn't mind changing dojo.NodeList?'s filter to just be an alias to query(), but it is a slight change in behavior (but for the good, allows more selectors?), and it will be slower, but I think not having the qualification about the types of selectors will make it easier to use.

Peter, Eugene, Alex, any thoughts on mapping dojo.NodeList?'s filter() to be just query()?

comment:2 Changed 10 years ago by dante

I'm curious how much slower the "enhanced" .query is compared to the "limited" filter.

comment:3 Changed 10 years ago by Les

dojox.jq compatibility layer will not match jQuery unless this ticket is fixed.

comment:4 Changed 10 years ago by James Burke

Owner: changed from anonymous to James Burke

comment:5 Changed 10 years ago by James Burke

(In [20617]) Refs #10029: fixes the children() method and all NodeList?-traverse methods to use a slower dojo.query-based filter vs dojo._filterQueryResult. It allows more types of CSS selectors. Updated dojocampus docs for -travers. Leaving the ticket open to figure out what to do for dojo.NodeList?'s .filter method, but will be pushing that out to another milestone.

comment:6 Changed 10 years ago by James Burke

(In [20618]) Refs #10029, moved jq's _filterQueryResult to NodeList?-traverse \!strict

comment:7 Changed 10 years ago by James Burke

Milestone: tbdfuture

comment:8 Changed 7 years ago by bill

Cc: Kris Zyp added
Component: GeneralQuery
Milestone: future1.7
Resolution: fixed
Status: newclosed

It's working now, probably due to the new dojo/query module and related code.

Note: See TracTickets for help on using tickets.