DOMElement class

A node for HTML elements.

Inheritance
Implemented types
Mixed-in types

Constructors

DOMElement(String? tag, {Map<String, dynamic>? attributes, Object? id, Object? classes, Object? style, Object? content, bool? hidden, bool commented = false})
factory

Properties

allowContent bool
Indicates if this node accepts content.
finalinherited
asDOMElement DOMElement
no setteroverride
asDOMNode DOMNode
no setterinherited
attributes Map<String, dynamic>
no setter
attributesAsString Map<String, String>
no setter
attributesLength int
Returns the size of attributes Map.
no setter
attributesNames Iterable<String>
Returns the attributes names with values.
no setter
classes String?
Returns the attribute class.
getter/setter pair
classesList List<String>
Returns the list of class names of the attribute class.
getter/setter pair
commented bool
no getterinherited
content List<DOMNode>?
Actual list of nodes that represents the content of this node.
no setterinherited
domAttributes Map<String, DOMAttribute>
no setter
domGenerator DOMGenerator?
Returns the DOMGenerator associated with treeMap.
no setterinherited
hasAttributes bool
Returns true if this element has attributes.
no setter
hasEmptyAttributes bool
Returns true if this element has NO attributes.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasOnChangeListener bool
Returns true if has any onChange listener registered.
no setter
hasOnClickListener bool
Returns true if has any onClick listener registered.
no setter
hasOnErrorListener bool
Returns true if has any onError listener registered.
no setter
hasOnGenerateListener bool
Returns true if has any onGenerate listener registered.
no setterinherited
hasOnKeyDownListener bool
Returns true if has any onKeyDown listener registered.
no setter
hasOnKeyPressListener bool
Returns true if has any onKeyPress listener registered.
no setter
hasOnKeyUpListener bool
Returns true if has any onKeyUp listener registered.
no setter
hasOnLoadListener bool
Returns true if has any onLoad 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 setterinherited
hasOnlyTextNodes bool
Returns true if this node only have TextNode nodes.
no setterinherited
hasOnMouseOutListener bool
Returns true if has any onMouseOut listener registered.
no setter
hasOnMouseOverListener bool
Returns true if has any onMouseOver listener registered.
no setter
hasParent bool
Returns true if this node has a parent.
no setterinherited
hasTemplate bool
Returns true if this node has a DOMTemplate.
no setteroverride
hasUnresolvedTemplate bool
Returns true if this node has a text node with a unresolved DOMTemplate.
no setteroverride
hasValue bool
Returns true if has value.
no setterinherited
id String?
Returns the attribute id.
no setter
indexInParent int
Returns the index position of this node in the parent.
no setterinherited
isCommented bool
If true this node is commented (ignored).
no setterinherited
isEmptyContent bool
Returns true if this node content is empty (no children nodes).
no setterinherited
isGenerated bool
Returns true if this node has a generated element by domGenerator.
no setterinherited
isNotEmptyContent bool
Returns true if this node content is NOT empty (has children nodes). See isEmptyContent.
no setterinherited
isStringElement bool
Returns true if this element is a TextNode or a DOMElement of tag: sup, i, em, u, b, strong.
no setteroverride
isWhiteSpaceContent bool
Returns true if this node only have white space content.
no setteroverride
length int
Returns the total number of children nodes.
no setterinherited
nodes List<DOMNode>
Returns a copy List of children nodes.
no setterinherited
onChange EventStream<DOMEvent>
Event handler for change events.
no setter
onClick EventStream<DOMMouseEvent>
Event handler for click events.
no setter
onError EventStream<DOMEvent>
Event handler for load events.
no setter
onGenerate EventStream
Event handler for when this element is generated by DOMGenerator.
no setterinherited
onKeyDown EventStream<DOMEvent>
Event handler for change events.
no setter
onKeyPress EventStream<DOMEvent>
Event handler for change events.
no setter
onKeyUp EventStream<DOMEvent>
Event handler for change events.
no setter
onLoad EventStream<DOMEvent>
Event handler for load events.
no setter
onMouseOut EventStream<DOMMouseEvent>
Event handler for click mouseOut events.
no setter
onMouseOver EventStream<DOMMouseEvent>
Event handler for click mouseOver events.
no setter
parent DOMNode?
Returns the parent DOMNode of generated tree (by DOMGenerator).
getter/setter pairinherited
possibleAttributes Map<String, String>
Map of possible attributes for this element.
no setter
root DOMNode
Returns the root DOMNode of this element. If this node doesn't have a parent, will return this instance as root.
no setterinherited
runtime DOMNodeRuntime
Returns a DOMNodeRuntime with the actual generated node associated with treeMap and domGenerator.
no setterinherited
runtimeNode → dynamic
Returns runtime.node.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style CSS
Returns the attribute style as CSS.
getter/setter pair
styleText String?
getter/setter pair
tag String
The tag name in lower-case.
final
text String
Returns the content of this node as text.
no setterinherited
treeMap DOMTreeMap?
Returns the DOMTreeMap of the last generated tree of elements.
getter/setter pairinherited
value String?
no setteroverride
valueAsBool bool?
Returns value as bool.
no setterinherited
valueAsDouble double?
Returns value as double.
no setterinherited
valueAsInt int?
Returns value as bool.
no setterinherited
valueAsNum num?
Returns value as num.
no setterinherited

Methods

absorbNode(DOMNode other) bool
Absorb the content of other and appends to this node.
override
add(Object? entry) DOMElement
override
addAll(Iterable? entries) DOMNode
Adds all entries to children nodes.
inherited
addAllAttributes(Map<String, dynamic>? attributes) DOMElement
Add attributes to this instance.
addAsTag<T>(String tag, T entry, [ContentGenerator<T>? contentGenerator]) DOMNode
inherited
addClass(String className) → void
Adds a className to attribute class.
addEach<T>(Iterable<T> iterable, [ContentGenerator<T>? contentGenerator]) DOMElement
Adds each entry of iterable to content.
override
addEachAsTag<T>(String tag, Iterable<T> iterable, [ContentGenerator<T>? contentGenerator]) DOMElement
override
addHTML(String html) DOMElement
Parses html and add it to content.
override
appendToAttribute(String name, Object? value) DOMElement
Appends value to attribute of name. Useful for attributes like class and style.
apply<T extends DOMElement>({dynamic id, dynamic classes, dynamic style}) → T
Applies id, classes and style to this instance.
applyWhere<T extends DOMElement>(Object? selector, {dynamic id, dynamic classes, dynamic style}) → T
Applies id, classes and style to children nodes that matches selector.
buildCloseTagHTML() String
buildDOM<T>({DOMGenerator<T>? generator, T? parent, DOMContext<T>? context}) → T?
Builds a DOM using generator.
inherited
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.
override
buildOpenTagHTML({bool openCloseTag = false, bool resolveDSX = false, DOMContext? domContext}) String
catchNodesWhere<T extends DOMNode>(Object? selector, List<T> destiny) → void
inherited
checkNodes() → void
Checks children nodes integrity.
inherited
clearNodes() → void
Clear the children list.
inherited
containsAllClasses(Iterable<String>? classes) bool
Returns true if attribute class has all classes.
containsAnyClass(Iterable<String>? classes) bool
Returns true if attribute class has any of classes.
containsClass(String className) bool
Returns true if attribute class has the className.
containsNode(DOMNode node, {dynamic deep = true}) bool
Returns true if node is a child of this node.
inherited
copy() DOMElement
Copies this node.
override
copyContent() List<DOMNode>
Copies this node content.
inherited
duplicate() DOMNode?
Duplicate this node and add it to the parent.
inherited
duplicateNode(DOMNode node) DOMNode?
Duplicate node and add it to the children list.
inherited
equals(Object other) bool
Returns true if other is fully equals.
equalsAttributes(DOMElement other) bool
Returns true if other have the same attributes.
getAttribute(String name) DOMAttribute?
Returns DOMAttribute entry for name.
getAttributesSignature() String
Returns a deterministic String of all attributes entries.
getAttributeValue(String name, [DOMContext? domContext]) String?
Returns attribute value for name.
getAttributeValueAsBool(String name, [DOMContext? domContext]) bool
Calls getAttributeValue and returns parsed as bool.
getAttributeValueAsDouble(String name, [DOMContext? domContext]) double?
Calls getAttributeValue and returns parsed as double.
getAttributeValueAsInt(String name, [DOMContext? domContext]) int?
Calls getAttributeValue and returns parsed as int.
getRuntime<T>() DOMNodeRuntime<T>
Same as runtime, but casts to DOMNodeRuntime<T>.
inherited
getRuntimeNode<T>() → T?
Same as runtimeNode, but casts to T.
inherited
hasAttributeValue(String name, [DOMContext? domContext]) bool
Returns true if attribute for name exists.
indexOf(Object? selector) int
Returns the index of a child node that matches selector.
inherited
indexOfNode(DOMNode node) int
Returns the index of node.
inherited
indexOfNodeIdentical(DOMNode node) int
inherited
indexOfNodeIdenticalFirst(DOMNode node) int
inherited
indexOfNodeWhere(bool test(DOMNode node)) int
inherited
insertAfter(Object? indexSelector, Object? entry) DOMElement
Inserts entry after index of child node that matches indexSelector.
override
insertAt(Object? indexSelector, Object? entry) DOMElement
Inserts entry at index of child node that matches indexSelector.
override
isCompatibleForMerge(DOMNode other) bool
Returns true if other is compatible to call merge.
override
isConsecutiveNode(DOMNode other) bool
Returns true if other is the previous or next sibling of this node parent.
inherited
isInSameParent(DOMNode other) bool
Returns true if other is in the same parent of this node.
inherited
isNextNode(DOMNode other) bool
Returns true if other is the next sibling of this node parent.
inherited
isPreviousNode(DOMNode other) bool
Returns true if other is the previous sibling of this node parent.
inherited
isTagOneOf(Iterable<String> tags) bool
Returns true if tag is one of tags.
merge(DOMNode other, {bool onlyConsecutive = true}) bool
Merges this node with other. Useful for consecutive text elements like b, i and span.
override
moveDown() bool
Moves this node down in the parent children list.
inherited
moveDownNode(DOMNode node) bool
Moves node down in the children list.
inherited
moveUp() bool
Moves this node up in the parent children list.
inherited
moveUpNode(DOMNode node) bool
Moves node up in the children list.
inherited
node<T extends DOMNode>(Object? selector) → T?
inherited
nodeByID<T extends DOMNode>(String? id) → T?
Returns a child node by id.
inherited
nodeByIndex<T extends DOMNode>(int? index) → T?
Returns a child node by index.
inherited
nodeEquals<T extends DOMNode>(DOMNode? node) → T?
Returns a node T that is equals to node.
inherited
nodesWhere<T extends DOMNode>(Object? selector) List<T>
Returns a List<T> of children nodes that matches selector.
inherited
nodeWhere<T extends DOMNode>(Object? selector) → T?
inherited
normalizeContent() → void
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyElementGenerated(Object? element) → void
Dispatch a onGenerate event with element.
inherited
putDOMAttribute(DOMAttribute attribute) DOMElement
remove() bool
Removes this node from parent.
inherited
removeAttribute(String attributeName) bool
removeAttributeDeeply(String attributeName) bool
removeNode(DOMNode node) bool
Removes node from children list.
inherited
resolveDSX() → void
select<T extends DOMNode>(Object? selector) → T?
Returns a node T that matches selector.
inherited
selectAllByType<T extends DOMNode>() List<T>
Returns a List<T> of children nodes that are of type T.
inherited
selectAllWhere<T extends DOMNode>(Object? selector) List<T>
Returns a List<T> of children nodes that matches selector.
inherited
selectByID<T extends DOMNode>(String? id) → T?
Returns a node T that has attribute id.
inherited
selectByTag<T extends DOMNode>(List<String>? tags) → T?
Returns a node T that is one of tags.
inherited
selectByType<T extends DOMNode>() → T?
Returns a child node of type T.
inherited
selectEquals<T extends DOMNode>(DOMNode? node) → T?
inherited
selectParentWhere<T extends DOMNode>(Object? selector) → T?
Returns a parent T that matches selector.
inherited
selectWhere<T extends DOMNode>(Object? selector) → T?
Returns a T child node that matches selector.
inherited
selectWithAllClasses<T extends DOMNode>(List<String>? classes) → T?
Returns a node T that has all classes.
inherited
selectWithAnyClass<T extends DOMNode>(List<String>? classes) → T?
Returns a node T that has any of classes.
inherited
setAttribute(String name, Object? value) DOMElement
Sets attribute for name, parsing value.
setAttributeIfAbsent(String name, Object? value) DOMElement
setContent(Object? newContent) DOMElement
Sets the content of this node.
override
toString() String
A string representation of this object.
override
validator(Function validator, {String? errorClass, String? validClass}) StreamSubscription<DOMEvent>
Sets the validator of this DOMElement.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String name) String?
operator []=(String name, Object? value) → void

Static Methods

isStringTagName(String? tag) bool
normalizeTag(String? tag) String?
Normalizes a tag name. Returns null for empty string.
objectHashcode(Object? o) int

Constants

possibleGlobalAttributes → const Set<String>