Selector Class
Provides support for using CSS selectors to query the DOM
Item Index
Methods
ancestor
-
node
-
selector
-
testSelf
A convenience method to emulate Y.Node's aNode.ancestor(selector).
Parameters:
-
node
HTMLElementA node to start the query from.
-
selector
StringA CSS selector to test the node against.
-
testSelf
Booleanoptional Whether or not to include the node in the scan.
Returns:
The ancestor node matching the selector, or null.
filter
-
nodes
-
selector
Filters out nodes that do not match the given CSS selector.
Parameters:
-
nodes
HTMLElement[]An array of nodes.
-
selector
StringA CSS selector to test each node against.
Returns:
The nodes that matched the given CSS selector.
query
-
selector
-
root
-
firstOnly
Retrieves a set of nodes based on a given CSS selector.
Parameters:
-
selector
StringA CSS selector.
-
root
HTMLElementoptional A node to start the query from. Defaults to
Y.config.doc
. -
firstOnly
Booleanoptional Whether or not to return only the first match.
Returns:
The array of nodes that matched the given selector.
test
-
node
-
selector
-
root
Determines whether or not the given node matches the given CSS selector.
Parameters:
-
node
HTMLElementA node to test.
-
selector
StringA CSS selector to test the node against.
-
root
HTMLElementoptional A node to start the query from. Defaults to the parent document of the node.
Returns:
Whether or not the given node matched the given CSS selector.
Properties
operators
Object
List of operators and corresponding boolean functions. These functions are passed the attribute and the current node's value of the attribute.
useNative
Unknown
static
Use the native version of querySelectorAll
, if it exists.
Default: true