TableCell

Represents anything that can be a table cell - <td> or <th> html.

Constructors

this
this(Document _parentDocument, string _tagName)

.

Members

Properties

colspan
int colspan [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
colspan
int colspan [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
rowspan
int rowspan [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
rowspan
int rowspan [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From Element

requireElementById
SomeElementType requireElementById(string id, string file, size_t line)

Calls getElementById, but throws instead of returning null if the element is not found. You can also ask for a specific subclass of Element to dynamically cast to, which also throws if it cannot be done.

requireSelector
SomeElementType requireSelector(string selector, string file, size_t line)

ditto but with selectors instead of ids

optionSelector
MaybeNullElement!SomeElementType optionSelector(string selector, string file, size_t line)

If a matching selector is found, it returns that Element. Otherwise, the returned object returns null for all methods.

classes
string[] classes [@property getter]

get all the classes on this element

addClass
Element addClass(string c)

Adds a string to the class attribute. The class attribute is used a lot in CSS.

removeClass
Element removeClass(string c)

Removes a particular class name.

hasClass
bool hasClass(string c)

Returns whether the given class appears in this element.

addChild
Element addChild(string tagName, string childInfo, string childInfo2)

convenience function to quickly add a tag with some text or other relevant info (for example, it's a src for an <img> element instead of inner text)

addSibling
Element addSibling(string tagName, string childInfo, string childInfo2)

Another convenience function. Adds a child directly after the current one, returning the new child.

addSibling
Element addSibling(Element e)
addChild
Element addChild(Element e)
addChildren
void addChildren(T t)

Convenience function to append text intermixed with other children. For example: div.addChildren("You can visit my website by ", new Link("mysite.com", "clicking here"), "."); or div.addChildren("Hello, ", user.name, "!"); See also: appendHtml. This might be a bit simpler though because you don't have to think about escaping.

addChild
Element addChild(string tagName, Element firstChild, string info2)

.

addChild
Element addChild(string tagName, Html innerHtml, string info2)
appendChildren
void appendChildren(Element[] children)

.

reparent
void reparent(Element newParent)

.

stripOut
void stripOut()

Strips this tag out of the document, putting its inner html as children of the parent.

removeFromTree
Element removeFromTree()

shorthand for this.parentNode.removeChild(this) with parentNode null check if the element already isn't in a tree, it does nothing.

wrapIn
Element wrapIn(Element what)

Wraps this element inside the given element. It's like this.replaceWith(what); what.appendchild(this);

replaceWith
Element replaceWith(Element e)

Replaces this element with something else in the tree.

classNames
string[] classNames()

Splits the className into an array of each class given

firstInnerText
string firstInnerText()

Fetches the first consecutive text nodes concatenated together.

directText
string directText [@property getter]

Returns the text directly under this element.

directText
string directText [@property setter]

Sets the direct text, without modifying other child nodes.

setValue
void setValue(string field, string value)
Undocumented in source. Be warned that the author may not have intended to support it.
children
Element[] children;
Undocumented in source.
tagName
string tagName;

The name of the tag. Remember, changing this doesn't change the dynamic type of the object.

attributes
string[string] attributes;

This is where the attributes are actually stored. You should use getAttribute, setAttribute, and hasAttribute instead.

parentDocument
Document parentDocument;

Get the parent Document object that contains this element. It may be null, so remember to check for that.

parentNode
inout(Element) parentNode()

.

parentNode
Element parentNode(Element e)
Undocumented in source. Be warned that the author may not have intended to support it.
bubblingEventHandlers
EventHandler[][string] bubblingEventHandlers;
Undocumented in source.
capturingEventHandlers
EventHandler[][string] capturingEventHandlers;
Undocumented in source.
defaultEventHandlers
EventHandler[string] defaultEventHandlers;
Undocumented in source.
addEventListener
void addEventListener(string event, EventHandler handler, bool useCapture)
Undocumented in source. Be warned that the author may not have intended to support it.
make
Element make(string tagName, string childInfo, string childInfo2)

Convenience function to try to do the right thing for HTML. This is the main way I create elements.

make
Element make(string tagName, Html innerHtml, string childInfo2)
Undocumented in source. Be warned that the author may not have intended to support it.
make
Element make(string tagName, Element child, string childInfo2)
Undocumented in source. Be warned that the author may not have intended to support it.
firstChild
Element firstChild [@property getter]

Returns the first child of this element. If it has no children, returns null. Remember, text nodes are children too.

lastChild
Element lastChild [@property getter]
previousSibling
string previousSibling [@property setter]

.

nextSibling
string nextSibling [@property setter]

.

getParent
T getParent(string tagName)

Gets the nearest node, going up the chain, with the given tagName May return null or throw.

getElementById
Element getElementById(string id)

.

querySelector
Element querySelector(string selector)

Note: you can give multiple selectors, separated by commas. It will return the first match it finds.

querySelectorAll
Element[] querySelectorAll(string selector)

a more standards-compliant alias for getElementsBySelector

getElementsBySelector
Element[] getElementsBySelector(string selector)

Returns elements that match the given CSS selector

getElementsByClassName
Element[] getElementsByClassName(string cn)

.

getElementsByTagName
Element[] getElementsByTagName(string tag)

.

getAttribute
string getAttribute(string name)

Gets the given attribute value, or null if the attribute is not set.

setAttribute
Element setAttribute(string name, string value)

Sets an attribute. Returns this for easy chaining

hasAttribute
bool hasAttribute(string name)

Returns if the attribute exists.

removeAttribute
Element removeAttribute(string name)

Removes the given attribute from the element.

className
string className [@property getter]

Gets the class attribute's contents. Returns an empty string if it has no class.

className
string className [@property setter]

.

opDispatch
string opDispatch [@property setter]

Provides easy access to common HTML attributes, object style.

opDispatch
string opDispatch [@property setter]

Old access to attributes. Use attrs instead.

childNodes
const(Element[]) childNodes [@property getter]

Returns the element's children.

childNodes
Element[] childNodes [@property getter]

Mutable version of the same

dataset
DataSet dataset [@property getter]

HTML5's dataset property. It is an alternate view into attributes with the data- prefix. Given <a data-my-property="cool" />, we get assert(a.dataset.myProperty == "cool");

attrs
AttributeSet attrs [@property getter]

Gives dot/opIndex access to attributes

style
ElementStyle style [@property getter]

Provides both string and object style (like in Javascript) access to the style attribute.

style
string style [@property setter]

This sets the style attribute with a string.

computedStyle
CssStyle computedStyle [@property getter]

Don't use this.

expansionHook
void* expansionHook;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

offsetWidth
int offsetWidth;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

offsetHeight
int offsetHeight;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

offsetLeft
int offsetLeft;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

offsetTop
int offsetTop;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

offsetParent
Element offsetParent;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

hasLayout
bool hasLayout;

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

zIndex
int zIndex;
absoluteLeft
int absoluteLeft()
absoluteTop
int absoluteTop()

These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt

removeAllChildren
void removeAllChildren()

Removes all inner content from the tag; all child text and elements are gone.

appendChild
Element appendChild(Element e)

Appends the given element to this one. The given element must not have a parent already.

insertBefore
Element insertBefore(Element where, Element what)

Inserts the second element to this node, right before the first param

insertAfter
Element insertAfter(Element where, Element what)

Inserts the given element what as a sibling of the this element, after the element where in the parent node.

swapNode
Element swapNode(Element child, Element replacement)

swaps one child for a new thing. Returns the old child which is now parentless.

appendText
Element appendText(string text)

Appends the given to the node.

childElements
string childElements [@property setter]

Returns child elements which are of a tag type (excludes text, comments, etc.).

appendHtml
Element[] appendHtml(string html)

Appends the given html to the element, returning the elements appended

insertChildAfter
void insertChildAfter(Element child, Element where)

.

stealChildren
Element[] stealChildren(Element e, Element position)

Reparents all the child elements of e to this, leaving e childless.

prependChild
Element prependChild(Element e)

Puts the current element first in our children list. The given element must not have a parent already.

innerHTML
Appender!string innerHTML [@property setter]

Returns a string containing all child elements, formatted such that it could be pasted into an XML file.

innerHTML
Element innerHTML(string html, bool strict)
Html innerHTML [@property setter]

Takes some html and replaces the element's children with the tree made from the string.

outerHTML
string outerHTML [@property setter]

Replaces this node with the given html string, which is parsed

outerHTML
string outerHTML [@property getter]

Returns all the html for this element, including the tag itself.

innerRawSource
string innerRawSource [@property setter]

This sets the inner content of the element *without* trying to parse it. You can inject any code in there; this serves as an escape hatch from the dom.

replaceChild
Element replaceChild(Element find, Element replace)

.

replaceChild
void replaceChild(Element find, Element[] replace)

Replaces the given element with a whole group.

removeChild
Element removeChild(Element c)

Removes the given child from this list.

removeChildren
Element[] removeChildren()

This removes all the children from this element, returning the old list.

innerText
string innerText [@property getter]

Fetch the inside text, with all tags stripped out.

innerText
string innerText [@property setter]

Sets the inside text, replacing all children. You don't have to worry about entity encoding.

outerText
string outerText [@property setter]

Strips this node out of the document, replacing it with the given text

outerText
string outerText [@property getter]

Same result as innerText; the tag with all inner tags stripped out

cloned
Element cloned [@property getter]

This is a full clone of the element

cloneNode
Element cloneNode(bool deepClone)

Clones the node. If deepClone is true, clone all inner tags too. If false, only do this tag (and its attributes), but it will have no contents.

nodeValue
string nodeValue()

W3C DOM interface. Only really meaningful on TextNode instances, but the interface is present on the base class.

nodeType
int nodeType [@property getter]

.

toString
string toString()

Turns the whole element, including tag, attributes, and children, into a string which could be pasted into an XML file.

toPrettyStringIndent
string toPrettyStringIndent(bool insertComments, int indentationLevel)
Undocumented in source. Be warned that the author may not have intended to support it.
toPrettyString
string toPrettyString(bool insertComments, int indentationLevel)

Writes out with formatting. Be warned: formatting changes the contents. Use ONLY for eyeball debugging.

writeToAppender
string writeToAppender(Appender!string where)

This is the actual implementation used by toString. You can pass it a preallocated buffer to save some time. Returns the string it creates.

tree
ElementStream tree [@property getter]

Returns a lazy range of all its children, recursively.

addField
Element addField(string label, string name, string type, FormFieldOptions fieldOptions)

Tags: HTML, HTML5

addField
Element addField(Element label, string name, string type, FormFieldOptions fieldOptions)
Undocumented in source. Be warned that the author may not have intended to support it.
addField
Element addField(string label, string name, FormFieldOptions fieldOptions)
Undocumented in source. Be warned that the author may not have intended to support it.
addField
Element addField(string label, string name, string[string] options, FormFieldOptions fieldOptions)
Undocumented in source. Be warned that the author may not have intended to support it.
addSubmitButton
Element addSubmitButton(string label)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta