Options
All
  • Public
  • Public/Protected
  • All
Menu

Class xjs_Node

Wrapper for a Node.

see

https://www.w3.org/TR/dom/#node

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • summary

    Construct a new xjs_Node object.

    Parameters

    • node: Node

      the node to wrap

    Returns xjs_Node

Properties

Private _NODE

_NODE: Node
summary

The wrapped DOM Node.

Static NodeType

NodeType: NodeType = NodeType

Accessors

node

  • get node(): Node

Methods

empty

  • empty(): this
  • summary

    Remove all child nodes from this node, and return it.

    Returns this

    this

exe

  • exe(executable: function): this
  • summary

    Execute a function acting on this node, and then return this node.

    description

    Simplifies chaining when performing void tasks, especially tasks that have not been defined in this implementation.

    Parameters

    • executable: function

      any function that takes 0 arguments and returns undefined (or does not have a return statement)

    Returns this

    this

textContent

  • textContent(): string | null
  • textContent(text: string): this

trimInner

  • trimInner(): this
  • summary

    Remove all inner whitespace text nodes from this node, and return it.

    example

    let snip = new HTMLElement(document.createElement('div')).addContent(<h1> <em>Hello </em> <b>Worl d</b> </h1>) let snipTrimmed = new xjs.Node(snip).trimInner() return snip.node.innerHTML === <h1> <em>Hello </em> <b>Worl d</b> </h1> && snipTrimmed.node.innerHTML = <h1><em>Hello </em><b>Worl d</b></h1>

    Returns this

    this

Generated using TypeDoc