pseudo-dom
    Preparing search index...

    Class HTMLElementService

    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 visible
    • title: the title attribute, which affects the text visible on hover
    • offsetHeight, offsetWidth: the height and width of the element as offset by the parent element
    • offsetLeft, offsetTop: the position of the left and top sides of the element based on the parent element
    • offsetParent: a reference to the closest positioned parent element

    Hierarchy (View Summary)

    Implements

    Index
    animations: any[] = []

    What getAnimations() returns - set this directly.

    boundingClientRect: DOMRect = ...

    What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly.

    childList: PseudoNodeList | LinkedTreeList

    The 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).

    clientHeight: number

    Returns a number representing the inner height of the element.

    clientLeft: number

    Returns a number representing the width of the left border of the element.

    clientRects: DOMRect[] = []

    What getClientRects() returns - set this directly.

    clientTop: number

    Returns a number representing the width of the top border of the element.

    clientWidth: number

    Returns a number representing the inner width of the element.

    id: string

    A string representing the id of the element.

    isVisible: boolean = true

    What checkVisibility() returns - set this directly.

    listLinker: TreeLinker

    The linker which holds this node in the children list of its parent, from which its siblings are found (null while it has no parent).

    nodeNameValue: string
    ownerDocumentStore: PseudoDocument

    The document which made this node (createElement and the like), for when it is not in a tree yet.

    parent: PseudoNode
    scrollHeight: number

    Returns a number representing the scroll view height of an element.

    scrollLeft: number

    A number representing the left scroll offset of the element.

    scrollTop: number

    A number representing number of pixels the top of the element is scrolled vertically.

    scrollWidth: number

    Returns a number representing the scroll view width of the element.

    type: string
    ATTRIBUTE_NODE: 2
    CDATA_SECTION_NODE: 4
    COMMENT_NODE: 8
    DEFAULT_NODE: 0
    DOCUMENT_FRAGMENT_NODE: 11
    DOCUMENT_NODE: 9
    DOCUMENT_POSITION_CONTAINED_BY: 16
    DOCUMENT_POSITION_CONTAINS: 8
    DOCUMENT_POSITION_DISCONNECTED: 1
    DOCUMENT_POSITION_FOLLOWING: 4
    DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32
    DOCUMENT_POSITION_PRECEDING: 2
    DOCUMENT_TYPE_NODE: 10
    ELEMENT_NODE: 1
    ENTITY_NODE: 6
    ENTITY_REFERENCE_NODE: 5
    NOTATION_NODE: 12
    PROCESSING_INSTRUCTION_NODE: 7
    TEXT_NODE: 3
    • get acceptsChildren(): boolean

      Whether this kind of node can have children (text, comments and attributes cannot).

      Returns boolean

    • get ariaAtomic(): string

      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.

      Returns string

    • set ariaAtomic(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaAutoComplete(): string

      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.

      Returns string

    • set ariaAutoComplete(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaBusy(): string

      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.

      Returns string

    • set ariaBusy(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaChecked(): string

      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.

      Returns string

    • set ariaChecked(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaColCount(): string

      A string reflecting the aria-colcount attribute, which defines the number of columns in a table, grid, or treegrid.

      Returns string

    • set ariaColCount(value: string): void

      A string reflecting the aria-colcount attribute, which defines the number of columns in a table, grid, or treegrid.

      Parameters

      • value: string

      Returns void

    • get ariaColIndex(): string

      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.

      Returns string

    • set ariaColIndex(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaColSpan(): string

      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.

      Returns string

    • set ariaColSpan(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaCurrent(): string

      A string reflecting the aria-current attribute, which indicates the element that represents the current item within a container or set of related elements.

      Returns string

    • set ariaCurrent(value: string): void

      A string reflecting the aria-current attribute, which indicates the element that represents the current item within a container or set of related elements.

      Parameters

      • value: string

      Returns void

    • get ariaDescription(): string

      A string reflecting the aria-description attribute, which defines a string value that describes or annotates the current element.

      Returns string

    • set ariaDescription(value: string): void

      A string reflecting the aria-description attribute, which defines a string value that describes or annotates the current element.

      Parameters

      • value: string

      Returns void

    • get ariaDisabled(): string

      A string reflecting the aria-disabled attribute, which indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.

      Returns string

    • set ariaDisabled(value: string): void

      A string reflecting the aria-disabled attribute, which indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.

      Parameters

      • value: string

      Returns void

    • get ariaExpanded(): string

      A string reflecting the aria-expanded attribute, which indicates whether a grouping element owned or controlled by this element is expanded or collapsed.

      Returns string

    • set ariaExpanded(value: string): void

      A string reflecting the aria-expanded attribute, which indicates whether a grouping element owned or controlled by this element is expanded or collapsed.

      Parameters

      • value: string

      Returns void

    • get ariaHasPopup(): string

      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.

      Returns string

    • set ariaHasPopup(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaHidden(): string

      A string reflecting the aria-hidden attribute, which indicates whether the element is exposed to an accessibility API.

      Returns string

    • set ariaHidden(value: string): void

      A string reflecting the aria-hidden attribute, which indicates whether the element is exposed to an accessibility API.

      Parameters

      • value: string

      Returns void

    • get ariaKeyShortcuts(): string

      A string reflecting the aria-keyshortcuts attribute, which indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.

      Returns string

    • set ariaKeyShortcuts(value: string): void

      A string reflecting the aria-keyshortcuts attribute, which indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.

      Parameters

      • value: string

      Returns void

    • get ariaLabel(): string

      A string reflecting the aria-label attribute, which defines a string value that labels the current element.

      Returns string

    • set ariaLabel(value: string): void

      A string reflecting the aria-label attribute, which defines a string value that labels the current element.

      Parameters

      • value: string

      Returns void

    • get ariaLevel(): string

      A string reflecting the aria-level attribute, which defines the hierarchical level of an element within a structure.

      Returns string

    • set ariaLevel(value: string): void

      A string reflecting the aria-level attribute, which defines the hierarchical level of an element within a structure.

      Parameters

      • value: string

      Returns void

    • get ariaLive(): string

      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.

      Returns string

    • set ariaLive(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaModal(): string

      A string reflecting the aria-modal attribute, which indicates whether an element is modal when displayed.

      Returns string

    • set ariaModal(value: string): void

      A string reflecting the aria-modal attribute, which indicates whether an element is modal when displayed.

      Parameters

      • value: string

      Returns void

    • get ariaMultiline(): string

      A string reflecting the aria-multiline attribute, which indicates whether a text box accepts multiple lines of input or only a single line.

      Returns string

    • set ariaMultiline(value: string): void

      A string reflecting the aria-multiline attribute, which indicates whether a text box accepts multiple lines of input or only a single line.

      Parameters

      • value: string

      Returns void

    • get ariaMultiSelectable(): string

      A string reflecting the aria-multiselectable attribute, which indicates that the user may select more than one item from the current selectable descendants.

      Returns string

    • set ariaMultiSelectable(value: string): void

      A string reflecting the aria-multiselectable attribute, which indicates that the user may select more than one item from the current selectable descendants.

      Parameters

      • value: string

      Returns void

    • get ariaOrientation(): string

      A string reflecting the aria-orientation attribute, which indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.

      Returns string

    • set ariaOrientation(value: string): void

      A string reflecting the aria-orientation attribute, which indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.

      Parameters

      • value: string

      Returns void

    • get ariaPlaceholder(): string

      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.

      Returns string

    • set ariaPlaceholder(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaPosInSet(): string

      A string reflecting the aria-posinset attribute, which defines an element's number or position in the current set of listitems or treeitems.

      Returns string

    • set ariaPosInSet(value: string): void

      A string reflecting the aria-posinset attribute, which defines an element's number or position in the current set of listitems or treeitems.

      Parameters

      • value: string

      Returns void

    • get ariaPressed(): string

      A string reflecting the aria-pressed attribute, which indicates the current "pressed" state of toggle buttons.

      Returns string

    • set ariaPressed(value: string): void

      A string reflecting the aria-pressed attribute, which indicates the current "pressed" state of toggle buttons.

      Parameters

      • value: string

      Returns void

    • get ariaReadOnly(): string

      A string reflecting the aria-readonly attribute, which indicates that the element is not editable, but is otherwise operable.

      Returns string

    • set ariaReadOnly(value: string): void

      A string reflecting the aria-readonly attribute, which indicates that the element is not editable, but is otherwise operable.

      Parameters

      • value: string

      Returns void

    • get ariaRequired(): string

      A string reflecting the aria-required attribute, which indicates that user input is required on the element before a form may be submitted.

      Returns string

    • set ariaRequired(value: string): void

      A string reflecting the aria-required attribute, which indicates that user input is required on the element before a form may be submitted.

      Parameters

      • value: string

      Returns void

    • get ariaRoleDescription(): string

      A string reflecting the aria-roledescription attribute, which defines a human-readable, author-localized description for the role of an element.

      Returns string

    • set ariaRoleDescription(value: string): void

      A string reflecting the aria-roledescription attribute, which defines a human-readable, author-localized description for the role of an element.

      Parameters

      • value: string

      Returns void

    • get ariaRowCount(): string

      A string reflecting the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.

      Returns string

    • set ariaRowCount(value: string): void

      A string reflecting the aria-rowcount attribute, which defines the total number of rows in a table, grid, or treegrid.

      Parameters

      • value: string

      Returns void

    • get ariaRowIndex(): string

      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.

      Returns string

    • set ariaRowIndex(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaRowSpan(): string

      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.

      Returns string

    • set ariaRowSpan(value: string): void

      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.

      Parameters

      • value: string

      Returns void

    • get ariaSelected(): string

      A string reflecting the aria-selected attribute, which indicates the current "selected" state of elements that have a selected state.

      Returns string

    • set ariaSelected(value: string): void

      A string reflecting the aria-selected attribute, which indicates the current "selected" state of elements that have a selected state.

      Parameters

      • value: string

      Returns void

    • get ariaSetSize(): string

      A string reflecting the aria-setsize attribute, which defines the number of items in the current set of listitems or treeitems.

      Returns string

    • set ariaSetSize(value: string): void

      A string reflecting the aria-setsize attribute, which defines the number of items in the current set of listitems or treeitems.

      Parameters

      • value: string

      Returns void

    • get ariaSort(): string

      A string reflecting the aria-sort attribute, which indicates if items in a table or grid are sorted in ascending or descending order.

      Returns string

    • set ariaSort(value: string): void

      A string reflecting the aria-sort attribute, which indicates if items in a table or grid are sorted in ascending or descending order.

      Parameters

      • value: string

      Returns void

    • get ariaValueMax(): string

      A string reflecting the aria-valueMax attribute, which defines the maximum allowed value for a range widget.

      Returns string

    • set ariaValueMax(value: string): void

      A string reflecting the aria-valueMax attribute, which defines the maximum allowed value for a range widget.

      Parameters

      • value: string

      Returns void

    • get ariaValueMin(): string

      A string reflecting the aria-valueMin attribute, which defines the minimum allowed value for a range widget.

      Returns string

    • set ariaValueMin(value: string): void

      A string reflecting the aria-valueMin attribute, which defines the minimum allowed value for a range widget.

      Parameters

      • value: string

      Returns void

    • get ariaValueText(): string

      A string reflecting the aria-valuetext attribute, which defines the human-readable text alternative of aria-valuenow for a range widget.

      Returns string

    • set ariaValueText(value: string): void

      A string reflecting the aria-valuetext attribute, which defines the human-readable text alternative of aria-valuenow for a range widget.

      Parameters

      • value: string

      Returns void

    • get baseURI(): string | Location

      Returns a string representing the base URL of the document containing the Node.

      Returns string | Location

    • get canFocus(): boolean

      Whether this element can have the focus: form controls and links which are not disabled, and anything with a tabindex.

      Returns boolean

    • get checked(): boolean

      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.

      Returns boolean

    • set checked(checked: boolean): void

      Parameters

      • checked: boolean

      Returns void

    • get childNodes(): PseudoNodeList | LinkedTreeList

      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.

      Returns PseudoNodeList | LinkedTreeList

    • get dataset(): { [key: string]: string }

      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 { [key: string]: string }

    • get innerHTML(): string

      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).

      Returns string

    • set innerHTML(html: string): void

      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().

      Parameters

      • html: string

      Returns void

    • get isConnected(): boolean

      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 boolean

    • get localName(): string

      The local part of the element's qualified name. There is no real namespace parsing here, so this is always the same as tagName.

      Returns string

    • get nodeName(): string

      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 string

    • get nodeType(): number

      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 number

    • get outerHTML(): string

      The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).

      Returns string

    • set outerHTML(html: string): void

      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.

      Parameters

      • html: string

      Returns void

    • get prefix(): string

      The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is always null.

      Returns string

    • get value(): string

      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.

      Returns string

    • set value(value: string): void

      Parameters

      • value: string

      Returns void

    • 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.

      Parameters

      • type: string

        The type of event to listen for

      • callback: any

        The function to call (or an object with a handleEvent function)

      • useCapture: boolean | listenerOptions = false

        Listen while the event travels down to the target (true), or an object with capture, once and passive

      Returns void

    • 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.

      Returns void

    • 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.

      Parameters

      Returns number

    • 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.

      Parameters

      Returns boolean

      False when the event was cancelable and a listener prevented the default, otherwise true

      When the event is already being dispatched, or (after the whole dispatch has finished) the error which a listener threw (an error with all of them in its errors property when several did)

    • 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.

      Returns void

    • Retrieve the value of an attribute. There is no real namespace parsing here, so this ignores the namespace and behaves exactly like getAttribute.

      Parameters

      • namespace: string

        Ignored

      • attributeName: string

      Returns string

      The value, or null when there is no such attribute

    • 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.

      Parameters

      • namespace: string

        Ignored

      • attributeName: string

      Returns boolean

    • Put text at a position relative to this element, the same as insertAdjacentElement but the text becomes a text node.

      Parameters

      • position: string

        beforebegin, afterbegin, beforeend or afterend

      • text: string

        The text to insert

      Returns void

      When the position is not one of the four above

    • 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.

      Parameters

      • x: number | { left?: number; top?: number } = 0
      • y: number = 0

      Returns void

    • 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.

      Parameters

      • namespace: string

        Ignored

      • attributeName: string
      • attributeValue: string

      Returns void

    • 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.

      Parameters

      • attributeName: string
      • Optionalforce: boolean

      Returns boolean