Generally, you don't want to call this yourself - use Element.make or document.createElement instead.
Convenience constructor when you don't care about the parentDocument. Note this might break things on the document. Note also that without a parent document, elements are always in strict, case-sensitive mode.
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
Tags: HTML, HTML5
Appends the given element to this one. The given element must not have a parent already.
Appends the given html to the element, returning the elements appended
.
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.
HTML5's dataset property. It is an alternate view into attributes with the data- prefix.
Gets the given attribute value, or null if the attribute is not set.
.
.
Does a CSS selector
.
Gets the nearest node, going up the chain, with the given tagName May return null or throw.
Returns if the attribute exists.
.
Inserts the second element to this node, right before the first param
.
.
Same result as innerText; the tag with all inner tags stripped out
Puts the current element first in our children list. The given element must not have a parent already.
Note: you can give multiple selectors, separated by commas. It will return the first match it finds.
a more standards-compliant alias for getElementsBySelector
Removes all inner content from the tag; all child text and elements are gone.
Removes the given attribute from the element.
Removes the given child from this list.
This removes all the children from this element, returning the old list.
.
Replaces the given element with a whole group.
Sets an attribute. Returns this for easy chaining
.
swaps one child for a new thing. Returns the old child which is now parentless.
Turns the whole element, including tag, attributes, and children, into a string which could be pasted into an XML file.
This is the actual implementation used by toString. You can pass it a preallocated buffer to save some time. Returns the string it creates.
.
Returns the element's children.
Mutable version of the same
Gets the class attribute's contents. Returns an empty string if it has no class.
.
This is a full clone of the element
.
Returns the first child of this element. If it has no children, returns null. Remember, text nodes are children too.
Returns a string containing all child elements, formatted such that it could be pasted into an XML file.
Takes some html and replaces the element's children with the tree made from the string.
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.
Fetch the inside text, with all tags stripped out.
Sets the inside text, replacing all children. You don't have to worry about entity encoding.
.
.
Provides easy access to attributes, object style.
Replaces this node with the given html string, which is parsed
Returns all the html for this element, including the tag itself. This is equivalent to calling toString().
Strips this node out of the document, replacing it with the given text
.
Provides both string and object style (like in Javascript) access to the style attribute.
This sets the style attribute with a string.
Returns a lazy range of all its children, recursively.
Convenience function to try to do the right thing for HTML. This is the main way I create elements.
This is where the attributes are actually stored. You should use getAttribute, setAttribute, and hasAttribute instead.
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
Get the parent Document object that contains this element. It may be null, so remember to check for that.
.
The name of the tag. Remember, changing this doesn't change the dynamic type of the object.
These properties are useless in most cases, but if you write a layout engine on top of this lib, they may be good +////ditt
This represents almost everything in the DOM.