Element

Represents an HTML element. Elements can be created using elem.

Element implicitly converts to a string, but when passed to elem, it will be recognized as HTML code, and it will not be escaped.

Element e1 = elem!"div"();
string  e2 = elem!"div"();
elems(e1);  // <div></div>
elems(e2);  // &lt;div&gt;&lt;/div&gt;

Element does not store its data in a structured manner, so its attributes and content cannot be read without using an XML parser. It does, however, have the capability of inserting attributes and content at runtime:

Element e = elem!"div"();
e ~= attr("class") = "one";
e ~= elem!"div"("two");
e ~= "three";

Alias This

toString

Members

Aliases

XMLDeclaration
alias XMLDeclaration = XMLDeclaration1_1

Default XML declaration element, uses version 1.1.

Functions

acceptsContent
bool acceptsContent()
addTrusted
Element addTrusted(string code)

Add trusted XML/HTML code as a child of this node.

opOpAssign
void opOpAssign(Ts args)

Append content to this node.

toString
string toString()

Convert the element to a string.

Manifest constants

HTMLDoctype
enum HTMLDoctype;

Document type declaration for HTML, used to enable standards mode in browsers.

MobileViewport
enum MobileViewport;

A common head element for adjusting the viewport to mobile devices.

Static functions

make
Element make()
Undocumented in source.

Variables

attributes
string attributes;
Undocumented in source.
content
string content;
Undocumented in source.
directive
bool directive;
Undocumented in source.
endTag
string endTag;
Undocumented in source.
startTag
string startTag;
Undocumented in source.
trail
string trail;
Undocumented in source.

Meta