Class Node

XML DOM Node Interface.

This is the base class from which all other node types are derived.

See the Node interface.

Tables

Node.properties Properties of the Node class

Methods

Node:appendChild (newChild) Appends a child node, implements appendChild.
Node:cloneNode (deep) Clones the node, implements cloneNode.
Node:hasAttributes () Checks if the Node has attributes, implements hasAttributes.
Node:hasChildNodes () Checks if the Node has child nodes, implements hasChildNodes.
Node:insertBefore (newChild[, refChild]) Inserts a child node, implements insertBefore.
Node:insertChildAtIndex (newChild[, index]) Inserts a child node at the given index.
Node:isDefaultNamespace (namespaceURI) Not implemented.
Node:isEqualNode (arg) Not implemented.
Node:isNamespaced () Checks if a Node is namespaced or not.
Node:isParent (parent) Recursively checks if the current node is a child of parent.
Node:isSupported (feature, version) Not implemented, should implement isSupported.
Node:lookupNamespaceURI (prefix) Not implemented.
Node:lookupPrefix (namespaceURI) Not implemented.
Node:nodeIndex (child) Returns the index of the child node.
Node:normalize () Normalizes the node recursively, implements normalize.
Node:removeChild (oldChild) Removes and returns a child node, implements removeChild.
Node:replaceChild (newChild, oldChild) Removes and returns a child node, implements replaceChild.


Tables

Node.properties
Properties of the Node class

Fields:

  • attributes NamedNodeMap holding the associated attributes (readonly), see per type
  • childNodes NodeList holding the child nodes (readonly)
  • firstChild the first child Node (readonly)
  • lastChild the last child Node (readonly)
  • localName (string) the localName (readonly)
  • namespaceURI (string) the namespace URI (readonly)
  • nextSibling the next sibling child Node from the parent Node (readonly)
  • nodeName (string) the nodeName (readonly), see per type
  • nodeType the type of node, see the constant TYPES (readonly)
  • nodeValue the node value, see descendant classes (readonly), see per type
  • ownerDocument the Document object, that owns/created this node (readonly)
  • parentNode the Node object, that owns this node (readonly)
  • prefix (string) the namespace prefix
  • previousSibling the previous sibling child Node from the parent Node (readonly)
  • qualifiedName (string) the nodes' qualified name, additional to the DOM2 spec (readonly)
  • textContent the text content of this node and its descendants (DOM level 3 property, readonly)

Methods

Node:appendChild (newChild)
Appends a child node, implements appendChild. If newChild is a DocumenFragment then all its children will be appended instead.

Parameters:

  • newChild Node the child Node to append.

Returns:

    newChild, or nil+err
Node:cloneNode (deep)
Clones the node, implements cloneNode.

Parameters:

  • deep bool if true create a recursive copy.

Returns:

    newChild, or nil+err
Node:hasAttributes ()
Checks if the Node has attributes, implements hasAttributes.

Returns:

    boolean
Node:hasChildNodes ()
Checks if the Node has child nodes, implements hasChildNodes.

Returns:

    boolean
Node:insertBefore (newChild[, refChild])
Inserts a child node, implements insertBefore. If newChild is a DocumenFragment then all its children will be inserted instead.

Parameters:

  • newChild Node the child Node to insert.
  • refChild Node the reference child before which newChild will be inserted. Defaults to appending at the end. (optional)

Returns:

    newChild, or nil+err
Node:insertChildAtIndex (newChild[, index])
Inserts a child node at the given index. If newChild is a DocumenFragment then all its children will be inserted instead. This is not a DOM2 method, added for convenience.

Parameters:

  • newChild Node the child node to insert.
  • index int where the child is to be inserted (defaults to appending) (optional)

Returns:

    integer (1-indexed), or nil+err
Node:isDefaultNamespace (namespaceURI)
Not implemented. Checks if the specified namespaceURI is the default namespace or not (DOM 3 method), implements isDefaultNamespace.

Parameters:

  • namespaceURI string the namespaceUri to check.

Returns:

    boolean
Node:isEqualNode (arg)
Not implemented. Checks equality, not sameness (DOM 3 method), implements isEqualNode.

Parameters:

Returns:

    boolean
Node:isNamespaced ()
Checks if a Node is namespaced or not. This is an additional method over the DOM2 spec. The node must be either an Attribute or Element type, and have a namespace.

Returns:

    boolean
Node:isParent (parent)
Recursively checks if the current node is a child of parent. This is not a DOM2 method, added for convenience.

Parameters:

  • parent Node the Parent node to check for the child.

Returns:

    boolean, true if the current Node is located somewhere in the child-tree of parent
Node:isSupported (feature, version)
Not implemented, should implement isSupported.

Parameters:

  • feature string the feature to check
  • version string the version to check

Returns:

    throws an error for now
Node:lookupNamespaceURI (prefix)
Not implemented. Look up the namespace URI associated to the given prefix (DOM 3 method), implements lookupNamespaceURI.

Parameters:

  • prefix string the prefix to lookup.

Returns:

    the namespace URI, or nil if not found
Node:lookupPrefix (namespaceURI)
Not implemented. Look up the prefix associated to the given namespace URI (DOM 3 method), implements lookupPrefix.

Parameters:

  • namespaceURI string the namespaceUri to lookup.

Returns:

    the prefix, or nil if not found
Node:nodeIndex (child)
Returns the index of the child node. This is not a DOM2 method, added for convenience.

Parameters:

  • child Node the child node to look up in the current node.

Returns:

    integer (1-indexed), or nil+err
Node:normalize ()
Normalizes the node recursively, implements normalize. Will recursively combine all adjacent Text nodes and remove empty Text nodes.

Returns:

    nothing
Node:removeChild (oldChild)
Removes and returns a child node, implements removeChild.

Parameters:

  • oldChild Node the child Node to remove.

Returns:

    oldChild, or nil+err
Node:replaceChild (newChild, oldChild)
Removes and returns a child node, implements replaceChild. If newChild is a DocumenFragment then all its children will be inserted instead.

Parameters:

  • newChild Node the child Node to insert.
  • oldChild Node the child Node to remove.

Returns:

    oldChild, or nil+err
generated by LDoc 1.4.6 Last updated 2022-04-22 13:38:32