Enter a search term above to see results...
On This Page
Query - DOM Traversal
The DOM Traversal methods allow you to get from one element to another based off their relationship. Query supports piercing shadow DOM boundaries when using $$
find
Finds descendant elements that match the specified selector.
Syntax
Parameters
Name | Type | Description |
---|---|---|
childSelector | string | A selector to match descendant elements |
Returns
Query object containing the matched elements.
Usage
Standard
Shadow DOM
parent
Gets the parent of each element in the current set of matched elements.
Syntax
Parameters
Name | Type | Description |
---|---|---|
parentSelector | string | (Optional) A selector to filter parent elements |
Returns
Query object containing the parent elements.
Usage
Standard
Shadow DOM
children
Gets the children of each element in the set of matched elements.
Syntax
Parameters
Name | Type | Description |
---|---|---|
childSelector | string | (Optional) A selector to filter children elements |
Returns
Query object containing the child elements.
Usage
siblings
Gets the siblings of each element in the set of matched elements.
Syntax
Parameters
Name | Type | Description |
---|---|---|
siblingSelector | string | (Optional) A selector to filter sibling elements |
Returns
Query object containing the sibling elements.
Usage
Standard
Shadow DOM
closest
Finds the closest ancestor element that matches the selector.
Syntax
Parameters
Name | Type | Description |
---|---|---|
ancestorSelector | string | A selector to match ancestor elements |
Returns
Query object containing the closest matching ancestor.
Usage
Standard
Shadow DOM
next
Gets the immediately following sibling of each element in the set of matched elements.
Syntax
Parameters
Name | Type | Description |
---|---|---|
nextSelector | string | (Optional) A selector to filter the next element |
Returns
Query object containing the next sibling elements.
Usage
Standard
Shadow DOM
prev
Gets the immediately preceding sibling of each element in the set of matched elements.
Syntax
Parameters
Name | Type | Description |
---|---|---|
prevSelector | string | (Optional) A selector to filter the previous element |
Returns
Query object containing the previous sibling elements.