// Direct children of every node, in link order per parent
eles.children(criterion?: FilterLike<NodeData, EdgeData, NodeData, NodeData | EdgeData>): Collection<NodeData, EdgeData, NodeData>Direct children of every node, in link order per parent.
| Name | Description |
|---|---|
criterion: FilterLike<NodeData, EdgeData, NodeData, NodeData | EdgeData>? | an optional query object or predicate applied to the result, exactly as |
Fields of criterion
| Name | Description |
|---|---|
group: GroupName? | restrict to one group |
selected: boolean? | require the element (not) to be selected |
selectable: boolean? | whether the element may be selected by the user |
locked: boolean? | whether the element is locked in place |
grabbed: boolean? | whether the user is dragging the element |
grabbable: boolean? | whether the element may be dragged |
active: boolean? | whether the element is under an active press |
hovered: boolean? | whether the pointer is over the element |
emphasized: boolean? | whether the element is in the current emphasis (* |
parent: boolean? | structural (nodes only): has at least one child |
childless: boolean? | structural (nodes only): has no children — exactly |
child: boolean? | structural (nodes only): has a parent |
orphan: boolean? | structural (nodes only): has no parent — exactly |
collapsed: boolean? | whether this compound parent is in collapsed miniature state (nodes only) |
data: QueryData<Data>? | data-sidecar conditions per key; a bare value means equality. Typed, the keys are the queried elements' fields. |
Collection<NodeData, EdgeData, NodeData>the children
Example
cy.add({ data: { id: 'parent' } });cy.getElementById('a').move({ parent: 'parent' });cy.getElementById('b').move({ parent: 'parent' });console.log(cy.getElementById('parent').children().map(node => node.id()).sort()); // ["a","b"]