Methods
static getNodeText(node) → {string}
Retrieve text within node.
Take node.textContent for common cases (so including all children), or node.value for INPUT.
Remove HTML comments, trim the result and replace tabs & line feeds & carriage returns by spaces.
Parameters:
Name | Type | Description |
---|---|---|
node |
object | DOM node |
Text of node
static getSelectorNode(selector, parentNodeopt) → {object}
Retrieve the first node corresponding to given selector.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
string | Nodes selector (id or @id or tagName:class[index] or jsnodes:code or css:selector or jquery:selector or [child index]) that can be chained (parent/child/grandchild...). |
|
parentNode |
object |
<optional> |
parent node, document if not specified. Ignored when selector is an id. |
First selected node (parent node if selector is empty)
static getSelectorNodes(selector, parentNodeopt, firstOnlyopt, leafFilteropt) → {Array.<object>}
Provide an array of nodes corresponding to given selector.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
string | Nodes selector (id or @id or tagName:class[index] or jsnodes:code or css:selector or jquery:selector or [child index]) that can be chained (parent/child/grandchild...). |
|
parentNode |
object |
<optional> |
parent node, document if not specified. Ignored when selector is an id. |
firstOnly |
boolean |
<optional> |
Limit the search to first node found (performance improvement) |
leafFilter |
string |
<optional> |
css Selector to filter the leaf (performance improvement). Not use when [index] specified. |
List of selected nodes (parent node if selector is empty)
static getSelectorParentNode(selector, node) → {object}
Retrieve the first node in parent tree corresponding to given selector
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | Nodes selector (id or @id or tagName:class[index] or jsnodes:code or css:selector or jquery:selector or [child index]) that can be chained (parent/child/grandchild...). |
node |
object | Current node |
First parent node matching selector
static getSelectorText(selector, parentNodeopt, evtopt) → {string}
Retrieve text of the first node corresponding to given selector
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
string | Nodes selector (id or @id or tagName:class[index] or jsnodes:code or css:selector or jquery:selector or [child index]) that can be chained (parent/child/grandchild...). |
|
parentNode |
object |
<optional> |
parent node, document if not specified. Ignored when selector is an id. |
evt |
object |
<optional> |
Current event (forwarded to jsfunc:). |
Text of first selected node (or parent node text when selector is empty))
static isNodeClass(node, cn) → {boolean}
Check if a node contains a given class. Call node.classList.contains when available, scan className otherwise.
Parameters:
Name | Type | Description |
---|---|---|
node |
object | DOM node |
cn |
string | class name expected |
true if class is in the class list of the node