DOMNode class

Represents a DOM Node.

Implemented types

Constructors

DOMNode({dynamic content})

Properties

allowContent → bool
Indicates if this node accepts content.
final
asDOMNode → DOMNode
no setteroverride
commented ← bool
no getter
content → List<DOMNode>?
Actual list of nodes that represents the content of this node.
no setter
domGenerator → DOMGenerator?
Returns the DOMGenerator associated with treeMap.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasOnGenerateListener → bool
Returns true if has any onGenerate listener registered.
no setter
hasOnlyElementNodes → bool
Returns true if this node content is empty (no children nodes). Returns ![isEmpty]. Returns true if this node only have DOMElement nodes.
no setter
hasOnlyTextNodes → bool
Returns true if this node only have TextNode nodes.
no setter
hasParent → bool
Returns true if this node has a parent.
no setter
hasTemplate → bool
Returns true if this node has a DOMTemplate.
no setter
hasUnresolvedTemplate → bool
Returns true if this node has a text node with a unresolved DOMTemplate.
no setter
indexInParent → int
Returns the index position of this node in the parent.
no setter
isCommented → bool
If true this node is commented (ignored).
no setter
isEmptyContent → bool
Returns true if this node content is empty (no children nodes).
no setter
isGenerated → bool
Returns true if this node has a generated element by domGenerator.
no setter
isNotEmptyContent → bool
Returns true if this node content is NOT empty (has children nodes). See isEmptyContent.
no setter
isStringElement → bool
Returns true if this element is a TextNode or a DOMElement of tag: sup, i, em, u, b, strong.
no setter
isWhiteSpaceContent → bool
Returns true if this node only have white space content.
no setter
length → int
Returns the total number of children nodes.
no setter
nodes → List<DOMNode>
Returns a copy List of children nodes.
no setter
onGenerate → EventStream
Event handler for when this element is generated by DOMGenerator.
no setter
parent ↔ DOMNode?
Returns the parent DOMNode of generated tree (by DOMGenerator).
getter/setter pair
root → DOMNode
Returns the root DOMNode of this element. If this node doesn't have a parent, will return this instance as root.
no setter
runtime → DOMNodeRuntime
Returns a DOMNodeRuntime with the actual generated node associated with treeMap and domGenerator.
no setter
runtimeNode → dynamic
Returns runtime.node.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text → String
Returns the content of this node as text.
no setter
treeMap ↔ DOMTreeMap?
Returns the DOMTreeMap of the last generated tree of elements.
getter/setter pair

Methods

absorbNode(DOMNode other) → bool
Absorb the content of other and appends to this node.
add(Object? entry) → DOMNode
addAll(Iterable? entries) → DOMNode
Adds all entries to children nodes.
addAsTag<T>(String tag, T entry, [ContentGenerator<T>? contentGenerator]) → DOMNode
addEach<T>(Iterable<T> iterable, [ContentGenerator<T>? contentGenerator]) → DOMNode
Adds each entry of iterable to content.
addEachAsTag<T>(String tag, Iterable<T> iterable, [ContentGenerator<T>? contentGenerator]) → DOMNode
addHTML(String html) → DOMNode
Parses html and add it to content.
buildDOM<T>({DOMGenerator<T>? generator, T? parent, DOMContext<T>? context}) → T?
Builds a DOM using generator.
buildHTML({bool withIndent = false, String parentIndent = '', String indent = ' ', bool disableIndent = false, bool xhtml = false, bool resolveDSX = false, bool buildTemplates = false, DOMNode? parentNode, DOMNode? previousNode, DOMContext? domContext}) → String
Generates a HTML from this node tree.
catchNodesWhere<T extends DOMNode>(Object? selector, List<T> destiny) → void
checkNodes() → void
Checks children nodes integrity.
clearNodes() → void
Clear the children list.
containsNode(DOMNode node, {dynamic deep = true}) → bool
Returns true if node is a child of this node.
copy() → DOMNode
Copies this node.
copyContent() → List<DOMNode>
Copies this node content.
duplicate() → DOMNode?
Duplicate this node and add it to the parent.
duplicateNode(DOMNode node) → DOMNode?
Duplicate node and add it to the children list.
getRuntime<T>() → DOMNodeRuntime<T>
Same as runtime, but casts to DOMNodeRuntime<T>.
getRuntimeNode<T>() → T?
Same as runtimeNode, but casts to T.
indexOf(Object? selector) → int
Returns the index of a child node that matches selector.
indexOfNode(DOMNode node) → int
Returns the index of node.
indexOfNodeIdentical(DOMNode node) → int
indexOfNodeIdenticalFirst(DOMNode node) → int
indexOfNodeWhere(bool test(DOMNode other)) → int
insertAfter(Object? indexSelector, Object? entry) → DOMNode
Inserts entry after index of child node that matches indexSelector.
insertAt(Object? indexSelector, Object? entry) → DOMNode
Inserts entry at index of child node that matches indexSelector.
isCompatibleForMerge(DOMNode other) → bool
Returns true if other is compatible for merging.
isConsecutiveNode(DOMNode other) → bool
Returns true if other is the previous or next sibling of this node parent.
isInSameParent(DOMNode other) → bool
Returns true if other is in the same parent of this node.
isNextNode(DOMNode other) → bool
Returns true if other is the next sibling of this node parent.
isPreviousNode(DOMNode other) → bool
Returns true if other is the previous sibling of this node parent.
merge(DOMNode other, {bool onlyConsecutive = true}) → bool
Merges other node into this node.
moveDown() → bool
Moves this node down in the parent children list.
moveDownNode(DOMNode node) → bool
Moves node down in the children list.
moveUp() → bool
Moves this node up in the parent children list.
moveUpNode(DOMNode node) → bool
Moves node up in the children list.
node<T extends DOMNode>(Object? selector) → T?
nodeByID<T extends DOMNode>(String? id) → T?
Returns a child node by id.
nodeByIndex<T extends DOMNode>(int? index) → T?
Returns a child node by index.
nodeEquals<T extends DOMNode>(DOMNode? node) → T?
Returns a node T that is equals to node.
nodesWhere<T extends DOMNode>(Object? selector) → List<T>
Returns a List<T> of children nodes that matches selector.
nodeWhere<T extends DOMNode>(Object? selector) → T?
normalizeContent() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyElementGenerated(Object? element) → void
Dispatch a onGenerate event with element.
remove() → bool
Removes this node from parent.
removeNode(DOMNode node) → bool
Removes node from children list.
select<T extends DOMNode>(Object? selector) → T?
Returns a node T that matches selector.
selectAllByType<T extends DOMNode>() → List<T>
Returns a List<T> of children nodes that are of type T.
selectAllWhere<T extends DOMNode>(Object? selector) → List<T>
Returns a List<T> of children nodes that matches selector.
selectByID<T extends DOMNode>(String? id) → T?
Returns a node T that has attribute id.
selectByTag<T extends DOMNode>(List<String>? tags) → T?
Returns a node T that is one of tags.
selectByType<T extends DOMNode>() → T?
Returns a child node of type T.
selectEquals<T extends DOMNode>(DOMNode? node) → T?
selectParentWhere<T extends DOMNode>(Object? selector) → T?
Returns a parent T that matches selector.
selectWhere<T extends DOMNode>(Object? selector) → T?
Returns a T child node that matches selector.
selectWithAllClasses<T extends DOMNode>(List<String>? classes) → T?
Returns a node T that has all classes.
selectWithAnyClass<T extends DOMNode>(List<String>? classes) → T?
Returns a node T that has any of classes.
setContent(Object? newContent) → DOMNode
Sets the content of this node.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

defaultDomGenerator ↔ DOMGenerator
Returns the default DOMGenerator.
getter/setter pair
regexpWhiteSpace → RegExp
final

Static Methods

from(Object? entry) → DOMNode?
Creates a DOMNode from dynamic parameter entry.
parseNodes(Object? entry) → List<DOMNode>
Parses entry to a list of nodes.
parseString(String s) → Object?
parseStringNodes(String s) → List<DOMNode>?
setDefaultDomGeneratorToDartHTML() → DOMGenerator
Sets the default DOMGenerator to dart:html implementation.
toText(Object? nodes) → String
Converts nodes to a text String.