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:
-
nodeHTMLElementA node to start the query from.
-
selectorStringA CSS selector to test the node against.
-
testSelfBooleanoptional 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:
-
nodesHTMLElement[]An array of nodes.
-
selectorStringA 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:
-
selectorStringA CSS selector.
-
rootHTMLElementoptional A node to start the query from. Defaults to
Y.config.doc. -
firstOnlyBooleanoptional 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:
-
nodeHTMLElementA node to test.
-
selectorStringA CSS selector to test the node against.
-
rootHTMLElementoptional 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
