Node~optimizations Class
Optimizations for searching DOM tree.
Methods
ancestor
-
fn
-
test_self
Patch to speed up search for a single class name or single tag name. To use a regular expression, call getAncestorByClassName().
Parameters:
-
fn
String | Functionselector string or boolean method for testing elements
-
test_self
Booleanpass true to include the element itself in the scan
Returns:
getAncestorByClassName
-
class_name
-
test_self
Searches for an ancestor by class name. This is significantly faster than using Y.node.ancestor('.classname'), and it accepts a regular expression.
Parameters:
-
class_name
String | Regexpclass to search for
-
test_self
Booleanpass true to include the element itself in the scan
Returns:
getAncestorByTagName
-
tag_name
-
test_self
Searches for an ancestor by tag name. This is significantly faster than using Y.node.ancestor('tagname').
Parameters:
-
tag_name
Stringtag name to search for
-
test_self
Booleanpass true to include the element itself in the scan
Returns:
getElementsByClassName
-
class_name
-
tag_name
Searches for descendants by class name. Unlike Y.all(), this function accepts a regular expression.
Parameters:
-
class_name
String | Regexpclass to search for
-
tag_name
Stringoptional tag name to filter by
Returns:
Properties
class_re_prefix
String
static
Useful when constructing regular expressions that match CSS classes.
class_re_suffix
String
static
Useful when constructing regular expressions that match CSS classes.