Element

A html element

struct Element {}

Constructors

this
this(typeof(this) rhs)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

canFind
alias canFind = contains
Undocumented in source.
clone
alias clone = dup
Undocumented in source.

Functions

appendChild
void appendChild(E el)

Put a new child in the last position

appendSibling
void appendSibling(E el)

Append an element

byClass
auto byClass(string name)
byComment
auto byComment(string comment, bool stripSpaces)
byId
Element byId(string id)
bySelector
auto bySelector(string selector)
byTagName
auto byTagName(string name)
copyFrom
void copyFrom(E e, bool deep)

Copy another element here

dup
Element dup(bool deep)

Clone this element

opAssign
auto opAssign(string html)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
auto opAssign(typeof(this) rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
auto opAssign(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
auto opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) o)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(E e)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(Element e)
Undocumented in source. Be warned that the author may not have intended to support it.
prependChild
void prependChild(E el)

Put a new child in the first position

prependSibling
void prependSibling(E el)

Prepend an element

remove
bool remove()

Remove this element from the document

replaceWith
void replaceWith(E el)

Replace this element with another one

toString
string toString(bool deep)

Properties

attributes
auto attributes [@property getter]

Return a lazy range of attributes for this element

children
bool children [@property setter]

All the children contained in this element. (non-deep search)

classes
auto classes [@property getter]

All the classes of this element

contains
bool contains(E e, bool deep)
descendants
bool descendants [@property setter]

All the children contained in this element. (deep search)

firstChild
bool firstChild [@property setter]

The first child

getAttribute
string getAttribute [@property setter]

Get an attribute

hasAttribute
string hasAttribute [@property setter]

Check if an attribute exists

id
string id [@property getter]

The id of this element (if present)

innerHTML
string innerHTML [@property setter]

Set the html content of this element

innerHTML
string innerHTML [@property getter]

Get the content of this element

innerText
string innerText [@property getter]

Set the inner text of this element (replacing html)

innerText
string innerText [@property setter]

Get the inner text of this element (ignoring html tags)

isAncestorOf
E isAncestorOf [@property setter]
isDescendantOf
E isDescendantOf [@property setter]
isEmpty
bool isEmpty [@property getter]

Is this element empty?

isValid
bool isValid [@property getter]

Is this element valid?

lastChild
bool lastChild [@property setter]

The last child

name
string name [@property getter]

Tag

next
bool next [@property setter]

The next element in the document

outerHTML
string outerHTML [@property getter]
outerHTML
string outerHTML [@property setter]
owner
Document owner [@property getter]

The owner of this element

parent
Element parent [@property getter]

The parent element

prev
bool prev [@property setter]

The previous element in the document

removeAttribute
string removeAttribute [@property setter]

Remove an attribute from this element

setAttribute
void setAttribute(string name, string value)

Set an attribute for this element

Structs

Attribute
struct Attribute

A simple key/value struct representing a html attribute

Meta