Skip to main content
Version: Next

externalElement

An element within the DOM.

Hierarchy

  • NodeWithChildren
    • Element

Index

Constructors

externalconstructor

  • new Element(name, attribs, children, type): Element
  • Parameters

    • externalname: string

      Name of the tag, eg. div, span.

    • externalattribs: {}

      Object mapping attribute names to attribute values.

      • externaloptionalchildren: ChildNode[]

        Children of the node.

      • externaloptionaltype: Script | Style | Tag

      Returns Element

    Properties

    externalattribs

    attribs: {}

    Type declaration

      externalinheritedchildren

      children: ChildNode[]

      externalinheritedendIndex

      endIndex: null | number

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

      externalname

      name: string

      externaloptionalnamespace

      namespace?: string

      Element namespace (parse5 only).

      externalinheritednext

      next: null | ChildNode

      Next sibling

      externalinheritedparent

      parent: null | ParentNode

      Parent of the node

      externalinheritedprev

      prev: null | ChildNode

      Previous sibling

      externaloptionalsourceCodeLocation

      sourceCodeLocation?: null | TagSourceCodeLocation

      parse5 source code location info, with start & end tags.

      Available if parsing with parse5 and location info is enabled.

      externalinheritedstartIndex

      startIndex: null | number

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

      externaltype

      type: Script | Style | Tag

      The type of the node.

      externaloptionalx-attribsNamespace

      x-attribsNamespace?: Record<string, string>

      Element attribute namespaces (parse5 only).

      externaloptionalx-attribsPrefix

      x-attribsPrefix?: Record<string, string>

      Element attribute namespace-related prefixes (parse5 only).

      Accessors

      externalattributes

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

      externalinheritedchildNodes

      • get childNodes(): ChildNode[]
      • set childNodes(children): void
      • Same as children. DOM spec-compatible alias.


        Returns ChildNode[]

      • Parameters

        • externalchildren: ChildNode[]

        Returns void

      externalinheritedfirstChild

      • get firstChild(): null | ChildNode
      • First child of the node.


        Returns null | ChildNode

      externalinheritedlastChild

      • get lastChild(): null | ChildNode
      • Last child of the node.


        Returns null | ChildNode

      externalinheritednextSibling

      • get nextSibling(): null | ChildNode
      • set nextSibling(next): void
      • Same as next. DOM spec-compatible alias.


        Returns null | ChildNode

      • Parameters

        • externalnext: null | ChildNode

        Returns void

      externalnodeType

      • get nodeType(): 1
      • DOM spec-compatible node type.


        Returns 1

      externalinheritedparentNode

      • get parentNode(): null | ParentNode
      • set parentNode(parent): void
      • Same as parent. DOM spec-compatible alias.


        Returns null | ParentNode

      • Parameters

        • externalparent: null | ParentNode

        Returns void

      externalinheritedpreviousSibling

      • get previousSibling(): null | ChildNode
      • set previousSibling(prev): void
      • Same as prev. DOM spec-compatible alias.


        Returns null | ChildNode

      • Parameters

        • externalprev: null | ChildNode

        Returns void

      externaltagName

      • get tagName(): string
      • set tagName(name): void
      • Same as name. DOM spec-compatible alias.


        Returns string

      • Parameters

        • externalname: string

        Returns void

      Methods

      externalinheritedcloneNode

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


        Parameters

        • externalthis: T
        • externaloptionalrecursive: boolean

          Clone child nodes as well.

        Returns T

        A clone of the node.