Skip to main content

Element

reexport
class Element {
  attribs: any;
  children: Array<Node>;
  endIndex: null | number;
  name: string;
  next: null | Node;
  parent: null | NodeWithChildren;
  prev: null | Node;
  startIndex: null | number;
  type: ElementType;
  x-attribsNamespace?: Record<string, string>;
  x-attribsPrefix?: Record<string, string>;
  cloneNode: <
    T extends Node<T>
  >(recursive?: boolean) => T;
}

An element within the DOM.

Fields#

attribs#

required
attribs: any;

children#

required
children: Array<Node>;

endIndex#

required
endIndex: null | number;

The end index of the node. Requires withEndIndices on the handler to be `true.

name#

required
name: string;

next#

required
next: null | Node;

Next sibling

parent#

required
parent: null | NodeWithChildren;

Parent of the node

prev#

required
prev: null | Node;

Previous sibling

startIndex#

required
startIndex: null | number;

The start index of the node. Requires withStartIndices on the handler to be `true.

type#

required
type: ElementType;

x-attribsNamespace#

optional
x-attribsNamespace?: Record<string, string>;

x-attribsPrefix#

optional
x-attribsPrefix?: Record<string, string>;

Methods#

cloneNode#

required
cloneNode: <
  T extends Node<T>
>(recursive?: boolean) => T;

Clone this node, and optionally its children.

Parameters#

recursive

Clone child nodes as well.