Class: Element
Defined in: node_modules/domhandler/lib/node.d.ts:167
An element within the DOM.
Extends
NodeWithChildren
Constructors
Constructor
new Element(
name,attribs,children?,type?):Element
Defined in: node_modules/domhandler/lib/node.d.ts:178
Parameters
name
string
Name of the tag, eg. div, span.
attribs
Object mapping attribute names to attribute values.
children?
ChildNode[]
Children of the node.
type?
Script | Style | Tag
Returns
Element
Overrides
NodeWithChildren.constructor
Properties
attribs
attribs:
object
Defined in: node_modules/domhandler/lib/node.d.ts:169
Index Signature
[name: string]: string
children
children:
ChildNode[]
Defined in: node_modules/domhandler/lib/node.d.ts:126
Inherited from
NodeWithChildren.children
endIndex
endIndex:
null|number
Defined in: node_modules/domhandler/lib/node.d.ts:39
The end index of the node. Requires withEndIndices on the handler to be `true.
Inherited from
NodeWithChildren.endIndex
name
name:
string
Defined in: node_modules/domhandler/lib/node.d.ts:168
namespace?
optionalnamespace:string
Defined in: node_modules/domhandler/lib/node.d.ts:196
Element namespace (parse5 only).
next
next:
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:35
Next sibling
Inherited from
NodeWithChildren.next
parent
parent:
null|ParentNode
Defined in: node_modules/domhandler/lib/node.d.ts:31
Parent of the node
Inherited from
NodeWithChildren.parent
prev
prev:
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:33
Previous sibling
Inherited from
NodeWithChildren.prev
sourceCodeLocation?
optionalsourceCodeLocation:null|TagSourceCodeLocation
Defined in: node_modules/domhandler/lib/node.d.ts:187
parse5 source code location info, with start & end tags.
Available if parsing with parse5 and location info is enabled.
Overrides
NodeWithChildren.sourceCodeLocation
startIndex
startIndex:
null|number
Defined in: node_modules/domhandler/lib/node.d.ts:37
The start index of the node. Requires withStartIndices on the handler to be `true.
Inherited from
NodeWithChildren.startIndex
type
type:
Script|Style|Tag
Defined in: node_modules/domhandler/lib/node.d.ts:172
The type of the node.
Overrides
NodeWithChildren.type
x-attribsNamespace?
optionalx-attribsNamespace:Record<string,string>
Defined in: node_modules/domhandler/lib/node.d.ts:198
Element attribute namespaces (parse5 only).
x-attribsPrefix?
optionalx-attribsPrefix:Record<string,string>
Defined in: node_modules/domhandler/lib/node.d.ts:200
Element attribute namespace-related prefixes (parse5 only).
Accessors
attributes
Get Signature
get attributes():
Attribute[]
Defined in: node_modules/domhandler/lib/node.d.ts:194
Returns
Attribute[]
childNodes
Get Signature
get childNodes():
ChildNode[]
Defined in: node_modules/domhandler/lib/node.d.ts:139
Same as children. DOM spec-compatible alias.
Returns
ChildNode[]
Set Signature
set childNodes(
children):void
Defined in: node_modules/domhandler/lib/node.d.ts:140
Parameters
children
ChildNode[]
Returns
void
Inherited from
NodeWithChildren.childNodes
firstChild
Get Signature
get firstChild():
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:132
First child of the node.
Returns
null | ChildNode
Inherited from
NodeWithChildren.firstChild
lastChild
Get Signature
get lastChild():
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:134
Last child of the node.
Returns
null | ChildNode
Inherited from
NodeWithChildren.lastChild
nextSibling
Get Signature
get nextSibling():
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:67
Same as next. DOM spec-compatible alias.
Returns
null | ChildNode
Set Signature
set nextSibling(
next):void
Defined in: node_modules/domhandler/lib/node.d.ts:68
Parameters
next
null | ChildNode
Returns
void
Inherited from
NodeWithChildren.nextSibling
nodeType
Get Signature
get nodeType():
1
Defined in: node_modules/domhandler/lib/node.d.ts:181
DOM spec-compatible node type.
Returns
1
Overrides
NodeWithChildren.nodeType
parentNode
Get Signature
get parentNode():
null|ParentNode
Defined in: node_modules/domhandler/lib/node.d.ts:55
Same as parent. DOM spec-compatible alias.
Returns
null | ParentNode
Set Signature
set parentNode(
parent):void
Defined in: node_modules/domhandler/lib/node.d.ts:56
Parameters
parent
null | ParentNode
Returns
void
Inherited from
NodeWithChildren.parentNode
previousSibling
Get Signature
get previousSibling():
null|ChildNode
Defined in: node_modules/domhandler/lib/node.d.ts:61
Same as prev. DOM spec-compatible alias.
Returns
null | ChildNode
Set Signature
set previousSibling(
prev):void
Defined in: node_modules/domhandler/lib/node.d.ts:62
Parameters
prev
null | ChildNode
Returns
void
Inherited from
NodeWithChildren.previousSibling
tagName
Get Signature
get tagName():
string
Defined in: node_modules/domhandler/lib/node.d.ts:192
Same as name. DOM spec-compatible alias.
Returns
string
Set Signature
set tagName(
name):void
Defined in: node_modules/domhandler/lib/node.d.ts:193
Parameters
name
string
Returns
void
Methods
cloneNode()
cloneNode<
T>(this,recursive?):T
Defined in: node_modules/domhandler/lib/node.d.ts:75
Clone this node, and optionally its children.
Type Parameters
T
T extends Node
Parameters
this
T
recursive?
boolean
Clone child nodes as well.
Returns
T
A clone of the node.
Inherited from
NodeWithChildren.cloneNode