Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Element

Re-exporting all of the node types.

Hierarchy

Index

Constructors

constructor

  • new Element(name: string, attribs: {}, children?: Node[], type?: Script | Style | Tag): Element
  • Parameters

    • name: string

      Name of the tag, eg. div, span.

    • attribs: {}

      Object mapping attribute names to attribute values.

      • [name: string]: string
    • Optional children: Node[]

      Children of the node.

    • Optional type: Script | Style | Tag

    Returns Element

Properties

attribs

attribs: {}

Type declaration

  • [name: string]: string

children

children: Node[]

endIndex

endIndex: null | number

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

name

name: string

next

next: null | Node

Next sibling

parent

parent: null | NodeWithChildren

Parent of the node

prev

prev: null | Node

Previous sibling

startIndex

startIndex: null | number

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

type

type: ElementType

Optional x-attribsNamespace

x-attribsNamespace: Record<string, string>

Optional x-attribsPrefix

x-attribsPrefix: Record<string, string>

Accessors

attributes

  • get attributes(): Attribute[]
  • Returns Attribute[]

childNodes

  • get childNodes(): Node[]
  • set childNodes(children: Node[]): any
  • Returns Node[]

  • Parameters

    Returns any

firstChild

  • get firstChild(): null | Node
  • Returns null | Node

lastChild

  • get lastChild(): null | Node
  • Returns null | Node

nextSibling

  • get nextSibling(): null | Node
  • set nextSibling(next: null | Node): any
  • Returns null | Node

  • Parameters

    Returns any

nodeType

  • get nodeType(): number
  • Returns number

parentNode

  • Returns null | NodeWithChildren

  • Parameters

    Returns any

previousSibling

  • get previousSibling(): null | Node
  • set previousSibling(prev: null | Node): any
  • Returns null | Node

  • Parameters

    Returns any

tagName

  • get tagName(): string
  • set tagName(name: string): any
  • Returns string

  • Parameters

    • name: string

    Returns any

Methods

cloneNode

  • cloneNode<T>(recursive?: boolean): T
  • Clone this node, and optionally its children.

    Type parameters

    Parameters

    • Optional recursive: boolean

      Clone child nodes as well.

    Returns T

    A clone of the node.