filter
NodeList
filter
(
filter
)
Filters the NodeList instance to only the matching nodes
- Parameters:
-
filter <string|function>
A CSS selector string to apply to the list, or a boolean function to apply to each element in the list. The function will be passed three arguments, a Y.Node instance of the current node, the current index in the list, and the NodeList instance.
- Returns:
NodeList
- NodeList containing the updated collection
first
Node|NodeList
first
(
first
)
Returns either the first node in the list, if there is no arugment provided,
the first n-items in the list, if provided a numeric argument, or the first
item in the list which tests 'true' to the provide boolean function
- Parameters:
-
first <Integer|Function>
The number of items to return or the boolean function to execute against the list.
- Returns:
Node|NodeList
last
Node|NodeList
last
(
last
)
Returns either the last node in the list, if there is no arugment provided,
the last n-items in the list, if provided a numeric argument, or the last
item in the list which tests 'true' to the provide boolean function
- Parameters:
-
last <Integer|Function>
The number of items to return or the boolean function to execute against the list.
- Returns:
Node|NodeList
reject
NodeList
reject
(
filter
)
This inverse of filter. Applies :not to a selector, or builds a NodeList
consisting of all the nodes for which the argument is false
- Parameters:
-
filter <string|function>
A CSS selector string to apply to the list, or a boolean function to apply to each element in the list. The function will be passed three arguments, a Y.Node instance of the current node, the current index in the list, and the NodeList instance.
- Returns:
NodeList
- NodeList containing the updated collection