Simulate the HTMLElement object when the Dom is not available
What getAnimations() returns - set this directly.
What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly.
ProtectedchildThe raw list of every child node (all types), used to implement childNodes/firstChild/lastChild/insertBefore/removeChild. Not the same thing as Element.children (an HTMLCollection of just the element children).
Returns a number representing the inner height of the element.
Returns a number representing the width of the left border of the element.
What getClientRects() returns - set this directly.
Returns a number representing the width of the top border of the element.
Returns a number representing the inner width of the element.
A string representing the id of the element.
What checkVisibility() returns - set this directly.
ProtectedlistThe linker which holds this node in the children list of its parent, from which its siblings are found (null while it has no parent).
ProtectednodeProtectedownerThe document which made this node (createElement and the like), for when it is not in a tree yet.
Returns a number representing the scroll view height of an element.
A number representing the left scroll offset of the element.
A number representing number of pixels the top of the element is scrolled vertically.
Returns a number representing the scroll view width of the element.
Static ReadonlyATTRIBUTE_Static ReadonlyCDATA_Static ReadonlyCOMMENT_Static ReadonlyDEFAULT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyDOCUMENT_Static ReadonlyELEMENT_Static ReadonlyENTITY_Static ReadonlyENTITY_Static ReadonlyNOTATION_Static ReadonlyPROCESSING_Static ReadonlyTEXT_ProtectedacceptsWhether this kind of node can have children (text, comments and attributes cannot).
A string reflecting the aria-atomic attribute, which indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
A string reflecting the aria-atomic attribute, which indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
A string reflecting the aria-autocomplete attribute, which indicates whether inputting text could trigger display of one or more predictions of the user's intended value for a combobox, searchbox, or textbox and specifies how predictions would be presented if they were made.
A string reflecting the aria-autocomplete attribute, which indicates whether inputting text could trigger display of one or more predictions of the user's intended value for a combobox, searchbox, or textbox and specifies how predictions would be presented if they were made.
A string reflecting the aria-busy attribute, which indicates whether an element is being modified, as assistive technologies may want to wait until the modifications are complete before exposing them to the user.
A string reflecting the aria-busy attribute, which indicates whether an element is being modified, as assistive technologies may want to wait until the modifications are complete before exposing them to the user.
A string reflecting the aria-checked attribute, which indicates the current "checked" state of checkboxes, radio buttons, and other widgets that have a checked state.
A string reflecting the aria-checked attribute, which indicates the current "checked" state of checkboxes, radio buttons, and other widgets that have a checked state.
A string reflecting the aria-colcount attribute, which defines the number of columns in a table, grid, or treegrid.
A string reflecting the aria-colcount attribute, which defines the number of columns in a table, grid, or treegrid.
A string reflecting the aria-colindex attribute, which defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
A string reflecting the aria-colindex attribute, which defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
A string reflecting the aria-colspan attribute, which defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
A string reflecting the aria-colspan attribute, which defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
A string reflecting the aria-current attribute, which indicates the element that represents the current item within a container or set of related elements.
A string reflecting the aria-current attribute, which indicates the element that represents the current item within a container or set of related elements.
A string reflecting the aria-description attribute, which defines a string value that describes or annotates the current element.
A string reflecting the aria-description attribute, which defines a string value that describes or annotates the current element.
A string reflecting the aria-disabled attribute, which indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
A string reflecting the aria-disabled attribute, which indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
A string reflecting the aria-expanded attribute, which indicates whether a grouping element owned or controlled by this element is expanded or collapsed.
A string reflecting the aria-expanded attribute, which indicates whether a grouping element owned or controlled by this element is expanded or collapsed.
A string reflecting the aria-haspopup attribute, which indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
A string reflecting the aria-haspopup attribute, which indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
A string reflecting the aria-hidden attribute, which indicates whether the element is exposed to an accessibility API.
A string reflecting the aria-hidden attribute, which indicates whether the element is exposed to an accessibility API.
A string reflecting the aria-keyshortcuts attribute, which indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
A string reflecting the aria-keyshortcuts attribute, which indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
A string reflecting the aria-label attribute, which defines a string value that labels the current element.
A string reflecting the aria-label attribute, which defines a string value that labels the current element.
A string reflecting the aria-level attribute, which defines the hierarchical level of an element within a structure.
A string reflecting the aria-level attribute, which defines the hierarchical level of an element within a structure.
A string reflecting the aria-live attribute, which indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
A string reflecting the aria-live attribute, which indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
A string reflecting the aria-modal attribute, which indicates whether an element is modal when displayed.
A string reflecting the aria-modal attribute, which indicates whether an element is modal when displayed.
A string reflecting the aria-multiline attribute, which indicates whether a text box accepts multiple lines of input or only a single line.
A string reflecting the aria-multiline attribute, which indicates whether a text box accepts multiple lines of input or only a single line.
A string reflecting the aria-multiselectable attribute, which indicates that the user may select more than one item from the current selectable descendants.
A string reflecting the aria-multiselectable attribute, which indicates that the user may select more than one item from the current selectable descendants.
A string reflecting the aria-orientation attribute, which indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
A string reflecting the aria-orientation attribute, which indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
A string reflecting the aria-placeholder attribute, which defines a short hint intended to aid the user with data entry when the control has no value.
A string reflecting the aria-placeholder attribute, which defines a short hint intended to aid the user with data entry when the control has no value.
A string reflecting the aria-posinset attribute, which defines an element's number or position in the current set of listitems or treeitems.
A string reflecting the aria-posinset attribute, which defines an element's number or position in the current set of listitems or treeitems.
A string reflecting the aria-pressed attribute, which indicates the current "pressed" state of toggle buttons.
A string reflecting the aria-pressed attribute, which indicates the current "pressed" state of toggle buttons.
A string reflecting the aria-readonly attribute, which indicates that the element is not editable, but is otherwise operable.
A string reflecting the aria-readonly attribute, which indicates that the element is not editable, but is otherwise operable.
A string reflecting the aria-required attribute, which indicates that user input is required on the element before a form may be submitted.
A string reflecting the aria-required attribute, which indicates that user input is required on the element before a form may be submitted.
A string reflecting the aria-roledescription attribute, which defines a human-readable, author-localized description for the role of an element.
A string reflecting the aria-roledescription attribute, which defines a human-readable, author-localized description for the role of an element.
A string reflecting the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.
A string reflecting the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.
A string reflecting the aria-rowindex attribute, which defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
A string reflecting the aria-rowindex attribute, which defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
A string reflecting the aria-rowspan attribute, which defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
A string reflecting the aria-rowspan attribute, which defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
A string reflecting the aria-selected attribute, which indicates the current "selected" state of elements that have a selected state.
A string reflecting the aria-selected attribute, which indicates the current "selected" state of elements that have a selected state.
A string reflecting the aria-setsize attribute, which defines the number of items in the current set of listitems or treeitems.
A string reflecting the aria-setsize attribute, which defines the number of items in the current set of listitems or treeitems.
A string reflecting the aria-sort attribute, which indicates if items in a table or grid are sorted in ascending or descending order.
A string reflecting the aria-sort attribute, which indicates if items in a table or grid are sorted in ascending or descending order.
A string reflecting the aria-valueMax attribute, which defines the maximum allowed value for a range widget.
A string reflecting the aria-valueMax attribute, which defines the maximum allowed value for a range widget.
A string reflecting the aria-valueMin attribute, which defines the minimum allowed value for a range widget.
A string reflecting the aria-valueMin attribute, which defines the minimum allowed value for a range widget.
A string reflecting the aria-valueNow attribute, which defines the current value for a range widget.
A string reflecting the aria-valueNow attribute, which defines the current value for a range widget.
A string reflecting the aria-valuetext attribute, which defines the human-readable text alternative of aria-valuenow for a range widget.
A string reflecting the aria-valuetext attribute, which defines the human-readable text alternative of aria-valuenow for a range widget.
Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element.
Returns a string representing the base URL of the document containing the Node.
Whether this element can have the focus: form controls and links which are not disabled, and anything with a tabindex.
Whether a checkbox or radio input is checked. Until it is set, it follows the checked attribute (which sets the default); setting it never changes the attribute, like the DOM's. Only input has one.
How many element children this element has.
Returns a live NodeList containing all the children of this node (including elements, text and comments). NodeList being live means that if the children of the Node change, the NodeList object is automatically updated.
A live view of this element's element children (text, comments and the like are not included).
Returns a DOMTokenList containing the list of class attributes.
A string representing the class of the element.
A string representing the class of the element.
The element's data-* attributes, live, under their camelCase names (data-foo-bar <-> dataset.fooBar). Backed directly by getAttribute / setAttribute, so it is never out of sync with the attributes themselves.
Returns a Node representing the first direct child node of the node, or null if the node has no child.
The first child of this element which is an element, or null when there is none.
The HTML markup of this element's children. Only the getter is here (the setter, which needs to build new elements from parsed HTML, is on HTMLElementService - see its class comment).
Replace this element's children by parsing html. innerHTML's setter is here rather than on ElementService (which only has the getter) because building the new elements needs a concrete element class - see parse().
A boolean indicating whether or not the Node is connected (directly or indirectly) to the context object, e.g. the Document object in the case of the normal DOM, or the ShadowRoot in the case of a shadow DOM.
Returns a Node representing the last direct child node of the node, or null if the node has no child.
The last child of this element which is an element, or null when there is none.
The local part of the element's qualified name. There is no real namespace parsing here, so this is always the same as tagName.
The sibling after this one which is an element, or null when there is none.
Returns a Node representing the next node in the tree, or null if there isn't such node.
Returns a string containing the name of the Node. The structure of the name will differ with the node type. E.g. An HTMLElement will contain the name of the corresponding tag, like 'audio' for an HTMLAudioElement, a Text node will have the '#text' string, or a Document node will have the '#document' string.
Returns an unsigned short representing the type of the node. Possible values are:
| Name | Value | |---------------------------------------- | ELEMENT_NODE | 1 | | ATTRIBUTE_NODE | 2 | | TEXT_NODE | 3 | | CDATA_SECTION_NODE | 4 | | PROCESSING_INSTRUCTION_NODE | 7 | | COMMENT_NODE | 8 | | DOCUMENT_NODE | 9 | | DOCUMENT_TYPE_NODE | 10 | | DOCUMENT_FRAGMENT_NODE | 11 |
Returns the value of the current node.
Returns the value of the current node.
The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).
Replace this element itself, in its parent, by parsing html. Does nothing when it has no parent, like replaceWith. outerHTML's setter is here rather than on ElementService for the same reason as innerHTML's.
Returns the Document that this node belongs to. If the node is itself a document, returns null.
Returns an Element that is the parent of this node. If the node has no parent, or if that parent is not an Element, this property returns null.
Returns a Node that is the parent of this node. If there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null.
The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is always null.
The sibling before this one which is an element, or null when there is none.
Returns a Node representing the previous node in the tree, or null if there isn't such node.
This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is 'closed' - it still exists, but is not reachable this way, like the DOM's).
The element's inline styles: a live CSSStyleDeclaration-like object, so both style.setProperty('color', 'red') and style.color = 'red' work.
Returns a string with the name of the tag for the given element.
Returns the textual content of an element and all its descendants.
Returns the textual content of an element and all its descendants.
The current value of a form control. Until it is set (or edited), it is the value attribute (the default value), or '' when there is none ('on' for a checkbox or radio); setting it never changes the attribute, like the DOM's. Only form controls (input, textarea, select, button, option, output) have one.
Registers an event handler of a specific event type. Adding the same handler again for the same type and phase does nothing, like the DOM.
The type of event to listen for
The function to call (or an object with a handleEvent function)
Listen while the event travels down to the target (true), or an object with capture, once and passive
Add nodes (strings become text nodes) as this node's next siblings, in order. Does nothing when this node has no parent.
The nodes (or text) to add
Add nodes (strings become text nodes) as the last children of this node, in the order given.
The nodes (or text) to add
Add a node as the last child of this node (a node which is already in a tree is moved).
The node to add
The added node
Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
Add nodes (strings become text nodes) as this node's previous siblings, in order. Does nothing when this node has no parent.
The nodes (or text) to add
Take the focus away from the element, when it has it: it gets blur then focusout.
Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
ProtectedchildAn element which is added as a child gets its default events (for example a submit button submits its form).
The node which was inserted
Click the element: a click event is sent to it, which bubbles and can be cancelled, like one from a user but a script made it (so it is not trusted). A disabled element does nothing.
Make a copy of this node (without its parent, and without its event listeners). With deep the children are copied too, all the way down.
Copy the children as well
ProtectedcloneStyle is not attribute-backed like most properties (see the constructor), so cloneNode needs its own copy of it, and a form control keeps its current value and checkedness (as the DOM's cloneNode does).
The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or null when none of them do.
A CSS selector
Say where another node is in relation to this one, as the bits of NodeService.DOCUMENT_POSITION_*: 0 for this node itself, DISCONNECTED (with IMPLEMENTATION_SPECIFIC and a consistent PRECEDING or FOLLOWING) for a node in another tree, CONTAINS + PRECEDING when the other node is an ancestor, CONTAINED_BY + FOLLOWING when it is a descendant, otherwise PRECEDING or FOLLOWING by their order in the tree.
The node to locate
A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a real computed style - just what the element's own style object holds).
Check whether a node is this node or one of its descendants.
The node to look for
Dispatches an event to this target and through the tree: capture listeners of the ancestors from the root down, then the listeners of this target, then (when the event bubbles) the other listeners of the ancestors from the parent up to the root. stopPropagation() stops it reaching further targets, stopImmediatePropagation() also stops the remaining listeners of the current target. Afterwards, unless the default was prevented, the default action of this target (see setDefaultEvent) runs. The event can be dispatched again afterwards.
The event to dispatch
False when the event was cancelable and a listener prevented the default, otherwise true
ProtectedequalsStyle is not attribute-backed like most properties, so isEqualNode needs to compare it separately too.
The node to compare with
Give the element the focus. The element which had it gets blur then focusout, and this one gets focus then focusin (blur and focus do not bubble, focusin and focusout do). Nothing happens when the element cannot have the focus or already has it.
The Animation objects currently active on the element, settable directly - there is no animation engine here.
Retrieve the value of an attribute.
The value, or null when there is no such attribute
The name of every attribute on the element, in the order they were set.
Retrieve the node representation of an attribute.
An Attr for the attribute, or null when there is no such attribute
Retrieve the node representation of an attribute. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like getAttributeNode.
Ignored
An Attr for the attribute, or null when there is no such attribute
Retrieve the value of an attribute. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like getAttribute.
Ignored
The value, or null when there is no such attribute
The size of the element and its position, settable directly - there is no layout engine here to compute it.
The bounding rectangles for each line of text in the element, settable directly - there is no layout engine here to compute it.
Every element below this node which has all of the given (space separated) classes, live.
Every element below this node with the given tag name (or every element when tagName is *), live.
Every element below this node with the given tag name, live. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like getElementsByTagName.
Ignored
Returns the context object's root which optionally includes the shadow root if it is available.
Check whether the element has an attribute by that name.
Check whether the element has an attribute by that name. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like hasAttribute.
Ignored
Whether the element has any attributes at all.
Returns a boolean value indicating whether the element has any child nodes.
Whether this element currently has capture of the given pointer.
Put an element at a position relative to this one: beforebegin (before this element, as its previous sibling), afterbegin (as this element's first child), beforeend (as this element's last child) or afterend (after this element, as its next sibling).
beforebegin, afterbegin, beforeend or afterend
The element to insert
The inserted element, or null when the position needed a parent this element does not have
Insert a node as a child of this node, before the given child (or at the end when there is none). A node which is already in a tree is moved, and the children of a document fragment are moved in order.
The node to insert
The child of this node to insert before, or null to insert at the end
The inserted node
Accepts a namespace URI as an argument and returns a boolean value with a value of true if the namespace is the default namespace on the given node or false if not.
Whether another node is the same as this one, by what they hold: the same type, name and value (an element also needs the same attributes), and children which are equal in the same order.
The node to compare with
Returns a boolean value indicating whether the two nodes are the same (that is, they reference the same object).
Accepts a prefix and returns the namespace URI associated with it on the given node if found (and null if not). Supplying null for the prefix will return the default namespace.
Returns a string containing the prefix for a given namespace URI, if present, and null if not. When multiple prefixes are possible, the result is implementation-dependent.
Whether this element itself (not its descendants) matches the given CSS selector.
A CSS selector
Tidy the text below this node: neighbouring text nodes are joined into one and empty text nodes are removed.
Add nodes (strings become text nodes) as the first children of this node, in the order given.
The nodes (or text) to add
The first element below this node which matches the CSS selector, in tree order, or null when there is none.
A CSS selector
Every element below this node which matches the CSS selector, in tree order. A plain array (not a live collection): like the DOM's querySelectorAll, it is a snapshot taken when it is called.
A CSS selector
Release this element's capture of the given pointer, if it had it.
Remove this node from its parent. Does nothing when it has no parent.
Remove an attribute from the element.
Remove the node representation of an attribute from the element, and return it.
The removed Attr
When the element has no attribute matching attr.name
Remove an attribute from the element. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like removeAttribute.
Ignored
Remove a child from this node, it no longer has a parent or siblings afterwards.
The child node to remove
The removed node
Removes an event listener, the one which was added with the same type, handler and phase.
The type of event
The handler which was added
Whether the listener was a capture listener (true), or an object with capture
Replace a child of this node with another node (which is moved if it is already in a tree).
The node which takes the place
The child of this node to replace
The replaced node
Remove every child of this node and put the given nodes (strings become text nodes) in their place, in order.
The nodes (or text) to add
Put the given nodes (strings become text nodes) where this node is, in order, then remove this node. Does nothing when this node has no parent.
The nodes (or text) to put in this node's place
Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just resolves, like a browser granting the request would.
Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this just resolves, like a browser granting the request would.
Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable viewport here: this just sets scrollLeft / scrollTop.
Scroll by the given amount, relative to the current position.
Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so this does nothing (override it on an instance in a test which needs to observe the call).
Scroll to the given position. An alias for scroll.
Set the value of an attribute, adding the attribute if it did not exist.
Set the node representation of an attribute, adding the attribute if it did not exist. Returns any previous Attr that had the same name, or null when there was none.
The replaced Attr, or null when the attribute was new
Set the node representation of an attribute. There is no real namespace parsing here, so this behaves exactly like setAttributeNode (Attr.name already carries any prefix).
The replaced Attr, or null when the attribute was new
Set the value of an attribute, adding the attribute if it did not exist. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like setAttribute.
Ignored
ProtectedsetRegister the function to run when nothing else has prevented the default for this type of event.
Give this element capture of the given pointer.
Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says which of those to do instead. Returns whether the attribute is present after the call.
Optionalforce: boolean
Simulate the behaviour of the HTMLElement Class when there is no DOM available.
It also has these simple properties, which are stored as attributes:
hidden: state of whether the element is visibletitle: the title attribute, which affects the text visible on hoveroffsetHeight,offsetWidth: the height and width of the element as offset by the parent elementoffsetLeft,offsetTop: the position of the left and top sides of the element based on the parent elementoffsetParent: a reference to the closest positioned parent element