Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/gauntlet/imports/happy_dom.ts>IElement

Work-in-progress front-end tool which does put a smile on my face
Latest
interface IElement
implements IChildNode, INonDocumentTypeChildNode, IParentNode
Re-export
import { type IElement } from "https://deno.land/x/gauntlet@v0.0.9/imports/happy_dom.ts";

Element.

Properties

readonly
tagName: string
readonly
shadowRoot: IShadowRoot
readonly
classList: ClassList
readonly
namespaceURI: string
scrollTop: number
scrollLeft: number
id: string
className: string
innerHTML: string
outerHTML: string
readonly
attributes: { [k: string]: Attr | number; }

Methods

optional
attributeChangedCallback(
name: string,
oldValue: string,
newValue: string,
): void

Attribute changed callback.

setAttribute(name: string, value: string): void

Sets an attribute.

setAttributeNS(
namespaceURI: string,
name: string,
value: string,
): void

Sets a namespace attribute.

getAttribute(name: string): string

Returns attribute value.

getAttributeNS(namespace: string, localName: string): string

Returns namespace attribute value.

hasAttribute(name: string): boolean

Returns a boolean value indicating whether the specified element has the attribute or not.

hasAttributeNS(namespace: string, localName: string): boolean

Returns a boolean value indicating whether the specified element has the namespace attribute or not.

hasAttributes(): boolean

Returns "true" if the element has attributes.

removeAttribute(name: string): void

Removes an attribute.

removeAttributeNS(namespace: string, localName: string): void

Removes a namespace attribute.

attachShadow(_shadowRootInit: { mode: string; }): IShadowRoot

Attaches a shadow root.

scroll(x: { top?: number; left?: number; behavior?: string; } | number, y: number): void

Scrolls to a particular set of coordinates.

scrollTo(x: { top?: number; left?: number; behavior?: string; } | number, y: number): void

Scrolls to a particular set of coordinates.

getBoundingClientRect(): DOMRect

Returns the size of an element and its position relative to the viewport.

createTextRange(): Range

Returns a range.

matches(selector: string): boolean

The matches() method checks to see if the Element would be selected by the provided selectorString.

setAttributeNode(attribute: Attr): Attr

The setAttributeNode() method adds a new Attr node to the specified element.

setAttributeNodeNS(attribute: Attr): Attr

The setAttributeNodeNS() method adds a new Attr node to the specified element.

getAttributeNode(name: string): Attr

Returns an Attr node.

getAttributeNodeNS(namespace: string, nodeName: string): Attr

Returns a namespaced Attr node.

removeAttributeNode(attribute: Attr): void

Removes an Attr node.

removeAttributeNodeNS(attribute: Attr): void

Removes an Attr node.

cloneNode(deep: boolean): IElement

Clones a node.

insertAdjacentElement(position: TInsertAdjacentPositions, node: INode): INode | null

Inserts a node to the given position.

insertAdjacentHTML(position: TInsertAdjacentPositions, text: string): void

Inserts an HTML string to the given position.

insertAdjacentText(position: TInsertAdjacentPositions, text: string): void

Inserts text to the given position.