Node

Represents a single node in the DOM tree.

Constructors

this
this(Location loc = Location.init, string name = null, Attribute[] attributes = null, NodeContent[] contents = null, NodeAttribs attribs = NodeAttribs.none)

Constructs a new node.

Members

Enums

SpecialName
enum SpecialName

A set of names that identify special-purpose nodes

Functions

addText
void addText(string text, in ref Location loc)

Adds a piece of text to the node's contents.

getAttribute
inout(Attribute) getAttribute(string name)

Returns a given named attribute.

hasNonWhitespaceContent
bool hasNonWhitespaceContent()

Determines if this node has any non-whitespace contents.

isProceduralTextNode
bool isProceduralTextNode()

Tests if the node consists only of text and interpolations, but doesn't contain child nodes.

isTextNode
bool isTextNode()

Tests if the node consists of only a single, static string.

opEquals
bool opEquals(Object other_)

Compares all properties of two nodes for equality.

stripIfOnlyWhitespace
void stripIfOnlyWhitespace()

Removes all content if it conists of only white space.

stripLeadingWhitespace
void stripLeadingWhitespace()

Strips any leading whitespace from the contents.

stripTrailingWhitespace
void stripTrailingWhitespace()

Strips any trailign whitespace from the contents.

toString
string toString()

Outputs a simple string representation of the node.

Properties

class_
inout(Attribute) class_ [@property getter]

Returns "class" attribute - a white space separated list of style class identifiers.

id
inout(Attribute) id [@property getter]

Returns the "id" attribute.

Variables

attribs
NodeAttribs attribs;

Flags that control the parser and generator behavior.

attributes
Attribute[] attributes;

A key-value set of attributes.

contents
NodeContent[] contents;

The main contents of the node.

loc
Location loc;

Start location of the node in the source file.

name
string name;

Name of the node

Meta