Construct a new xjs_Node object.
the node to wrap
The wrapped DOM Node.
This wrapper’s node.
Remove all child nodes from this node, and return it.
this
the function to call in the context of this
this
the condition to evaluate; will be converted to boolean
the executable to call (in the context of this
) if the condition is truthy
the executable to call (in the context of this
) if the condition is falsy
this
Execute a callback acting on this node, and then return this node.
Simplifies chaining when performing void tasks, especially tasks that have not been defined in this implementation. Note that this function is not asynchronous, and does not accept asynchronous arguments.
the function to call, taking this
as its only argument, and returning void
this
Execute a function based on a condition.
Given a condition, execute one function upon passing, or execute another upon failure. Note that this function is not asynchronous, and does not accept asynchronous arguments.
the condition to evaluate; will be converted to boolean
the callback to call (with this
as its parameter) if the condition is truthy
the callback to call (with this
as its parameter) if the condition is falsy
this
Get Node#textContent.
the textContent
of this node
Set Node#textContent, and returns this object when done.
This method exists simply for chaining.
the content to set
this
Remove all inner whitespace text nodes from this node, and return it.
let div = document.createElement('div')
div.innerHTML = `
<h1>
<em>Hello </em>
<b>Worl d</b>
</h1>
`
let trimmed_div = new xjs.Node(div).trimInner().node
return div.innerHTML === `
<h1>
<em>Hello </em>
<b>Worl d</b>
</h1>
`
&& trimmed_div.innerHTML = `<h1><em>Hello </em><b>Worl d</b></h1>`
this
Generated using TypeDoc
Wrapper for a Node.
https://www.w3.org/TR/dom/#node