Opened 10 years ago

Closed 10 years ago

#9665 closed defect (invalid)

NodeList - can't select mulitple children elements

Reported by: Les Owned by: James Burke
Priority: high Milestone: 1.4
Component: Core Version: 1.3.2
Keywords: NodeList.children Cc:
Blocked By: Blocking:

Description

http://archive.dojotoolkit.org/nightly/dojotoolkit/dojo/tests/NodeList-manipulate.html

This code should return 7 elements, but it returns an empty array.

dojo.require("dojo.NodeList-traverse");
dojo.query('#inputForm').children('input,select')

This code however returns all 7 elements:

dojo.require("dojo.NodeList-traverse");
dojo.query('input,select')

Change History (3)

comment:1 Changed 10 years ago by Les

This also works fine (7 elements returned):

dojo.query('#inputForm').query('input,select')

comment:2 Changed 10 years ago by James Burke

Component: GeneralCore
Milestone: tbd1.4
Owner: changed from anonymous to James Burke

This happens because dojo._filterQueryResult is used underneath, and it is a very basic filter: just handles a simple selector that can be applied on one node without context.

I will look at switching all of those _filterQueryResult calls to just use dojo.query.

comment:3 Changed 10 years ago by James Burke

Resolution: invalid
Status: newclosed

This is actually working as designed, there are no immediate children of #inputForm that are input or select elements, the immediate children are divs that contain the elements. dojo.query('#inputForm').query('input,select') works because it is not restricting itself to immediate children but considers all nested children.

There is still a deficiency with the selectors supported by children, but I will use #10029 to track that.

Note: See TracTickets for help on using tickets.