Class Node
Represents a single node in the DOM tree.
class Node
;
Constructors
Name | Description |
---|---|
this
(loc, name, attributes, contents, attribs, translation_key)
|
Constructs a new node. |
Fields
Name | Type | Description |
---|---|---|
attribs
|
NodeAttribs | Flags that control the parser and generator behavior. |
attributes
|
Attribute[] | A key-value set of attributes. |
contents
|
NodeContent[] | The main contents of the node. |
loc
|
Location | Start location of the node in the source file. |
name
|
string | Name of the node |
translationKey
|
string | Original text used to look up the translation (only set if translated) |
Properties
Name | Type | Description |
---|---|---|
class_ [get]
|
inout(Attribute) | Returns "class" attribute - a white space separated list of style class identifiers. |
id [get]
|
inout(Attribute) | Returns the "id" attribute. |
Methods
Name | Description |
---|---|
addText
(text, loc)
|
Adds a piece of text to the node's contents. |
clone
()
|
|
getAttribute
(name)
|
Returns a given named attribute. |
hasAttribute
(name)
|
|
hasNonWhitespaceContent
()
|
Determines if this node has any non-whitespace contents. |
isProceduralTextNode
()
|
Tests if the node consists only of text and interpolations, but doesn't contain child nodes. |
isTextNode
()
|
Tests if the node consists of only a single, static string. |
opEquals
(other)
|
|
opEquals
(other_)
|
Compares all properties of two nodes for equality. |
setAttribute
(att)
|
|
stripIfOnlyWhitespace
()
|
Removes all content if it conists of only white space. |
stripLeadingWhitespace
()
|
Strips any leading whitespace from the contents. |
stripTrailingWhitespace
()
|
Strips any trailign whitespace from the contents. |
toString
()
|
Outputs a simple string representation of the node. |
Enums
Name | Description |
---|---|
SpecialName
|
A set of names that identify special-purpose nodes |