Element
Hierarchy
- NodeWithChildren
- Element
 
 
Index
Constructors
constructor
Parameters
name: string
Name of the tag, eg.
div,span.attributes: NodeAttribute[]
children: ChildNode[] = []
Children of the node.
type: Script | Style | Tag = ...
Returns Element
Properties
publicattributes
publicchildren
Children of the node. Only certain node types can have children.
endIndex
The end index of the node. Requires withEndIndices on the handler to be `true.
publicname
Name of the tag, eg. div, span.
optionalnamespace
Element namespace (parse5 only).
next
Next sibling
parent
Parent of the node
prev
Previous sibling
startIndex
The start index of the node. Requires withStartIndices on the handler to be `true.
publictype
The type of the node.
optionalx-attribsNamespace
Element attribute namespaces (parse5 only).
optionalx-attribsPrefix
Element attribute namespace-related prefixes (parse5 only).
Accessors
childNodes
close
firstChild
First child of the node.
Returns null | ChildNode
lastChild
Last child of the node.
Returns null | ChildNode
loc
nextSibling
nodeType
DOM spec-compatible node type.
Returns 1
open
parentNode
Same as parent. DOM spec-compatible alias.
Returns null | ParentNode
Parameters
parent: null | ParentNode
Returns void
previousSibling
tagName
Same as name. DOM spec-compatible alias.
Returns string
Parameters
name: string
Returns void
Methods
cloneNode
Clone this node, and optionally its children.
Type parameters
- T: Node
 
Parameters
this: T
recursive: boolean = false
Clone child nodes as well.
Returns T
A clone of the node.
An element within the DOM.