Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface Document

The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree.

MDN Reference

interface Document {
    activeElement: Element | null;
    activeViewTransition: ViewTransition | null;
    adoptedStyleSheets: CSSStyleSheet[];
    alinkColor: string;
    all: HTMLAllCollection;
    anchors: HTMLCollectionOf<HTMLAnchorElement>;
    applets: HTMLCollection;
    ATTRIBUTE_NODE: 2;
    baseURI: string;
    bgColor: string;
    body: HTMLElement;
    CDATA_SECTION_NODE: 4;
    characterSet: string;
    charset: string;
    childElementCount: number;
    childNodes: NodeListOf<ChildNode>;
    children: HTMLCollection;
    COMMENT_NODE: 8;
    compatMode: string;
    contentType: string;
    cookie: string;
    currentScript: HTMLOrSVGScriptElement | null;
    customElementRegistry: CustomElementRegistry | null;
    defaultView: Window & typeof globalThis | null;
    designMode: string;
    dir: string;
    doctype: DocumentType | null;
    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;
    documentElement: HTMLElement;
    documentURI: string;
    domain: string;
    ELEMENT_NODE: 1;
    embeds: HTMLCollectionOf<HTMLEmbedElement>;
    ENTITY_NODE: 6;
    ENTITY_REFERENCE_NODE: 5;
    fgColor: string;
    firstChild: ChildNode | null;
    firstElementChild: Element | null;
    fonts: FontFaceSet;
    forms: HTMLCollectionOf<HTMLFormElement>;
    fragmentDirective: FragmentDirective;
    fullscreen: boolean;
    fullscreenElement: Element | null;
    fullscreenEnabled: boolean;
    head: HTMLHeadElement;
    hidden: boolean;
    images: HTMLCollectionOf<HTMLImageElement>;
    implementation: DOMImplementation;
    inputEncoding: string;
    isConnected: boolean;
    lastChild: ChildNode | null;
    lastElementChild: Element | null;
    lastModified: string;
    linkColor: string;
    links: HTMLCollectionOf<HTMLAnchorElement | HTMLAreaElement>;
    nextSibling: ChildNode | null;
    nodeName: string;
    nodeType: number;
    nodeValue: string | null;
    NOTATION_NODE: 12;
    onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
    onanimationcancel:
        | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
        | null;
    onanimationend:
        | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
        | null;
    onanimationiteration:
        | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
        | null;
    onanimationstart:
        | ((this: GlobalEventHandlers, ev: AnimationEvent) => any)
        | null;
    onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
    onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
    onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onbeforetoggle:
        | ((this: GlobalEventHandlers, ev: ToggleEvent) => any)
        | null;
    onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
    oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
    onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncommand: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncontextmenu:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
    oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
    ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
    ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onerror: OnErrorEventHandler;
    onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
    onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
    onfullscreenchange: ((this: Document, ev: Event) => any) | null;
    onfullscreenerror: ((this: Document, ev: Event) => any) | null;
    ongotpointercapture:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    oninput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
    oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
    onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
    onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
    onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onlostpointercapture:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
    onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
    onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onpointercancel:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerdown:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerenter:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerleave:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerlockchange: ((this: Document, ev: Event) => any) | null;
    onpointerlockerror: ((this: Document, ev: Event) => any) | null;
    onpointermove:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
    onpointerover:
        | ((this: GlobalEventHandlers, ev: PointerEvent) => any)
        | null;
    onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
    onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
    onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onreadystatechange: ((this: Document, ev: Event) => any) | null;
    onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
    onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onsecuritypolicyviolation:
        | (
            (this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any
        )
        | null;
    onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
    onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
    ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
    ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
    ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
    ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null;
    ontransitioncancel:
        | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
        | null;
    ontransitionend:
        | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
        | null;
    ontransitionrun:
        | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
        | null;
    ontransitionstart:
        | ((this: GlobalEventHandlers, ev: TransitionEvent) => any)
        | null;
    onvisibilitychange: ((this: Document, ev: Event) => any) | null;
    onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
    onwebkitanimationend:
        | ((this: GlobalEventHandlers, ev: Event) => any)
        | null;
    onwebkitanimationiteration:
        | ((this: GlobalEventHandlers, ev: Event) => any)
        | null;
    onwebkitanimationstart:
        | ((this: GlobalEventHandlers, ev: Event) => any)
        | null;
    onwebkittransitionend:
        | ((this: GlobalEventHandlers, ev: Event) => any)
        | null;
    onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
    ownerDocument: null;
    parentElement: HTMLElement | null;
    parentNode: ParentNode | null;
    pictureInPictureElement: Element | null;
    pictureInPictureEnabled: boolean;
    plugins: HTMLCollectionOf<HTMLEmbedElement>;
    pointerLockElement: Element | null;
    previousSibling: ChildNode | null;
    PROCESSING_INSTRUCTION_NODE: 7;
    readyState: DocumentReadyState;
    referrer: string;
    rootElement: SVGSVGElement | null;
    scripts: HTMLCollectionOf<HTMLScriptElement>;
    scrollingElement: Element | null;
    styleSheets: StyleSheetList;
    TEXT_NODE: 3;
    timeline: DocumentTimeline;
    title: string;
    URL: string;
    visibilityState: DocumentVisibilityState;
    vlinkColor: string;
    get location(): Location;
    set location(href: string): void;
    get textContent(): null;
    addEventListener<K extends keyof DocumentEventMap>(
        type: K,
        listener: (this: Document, ev: DocumentEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    adoptNode<T extends Node>(node: T): T;
    append(...nodes: (string | Node)[]): void;
    appendChild<T extends Node>(node: T): T;
    captureEvents(): void;
    caretPositionFromPoint(
        x: number,
        y: number,
        options?: CaretPositionFromPointOptions,
    ): CaretPosition | null;
    caretRangeFromPoint(x: number, y: number): Range | null;
    clear(): void;
    cloneNode(subtree?: boolean): Node;
    close(): void;
    compareDocumentPosition(other: Node): number;
    contains(other: Node | null): boolean;
    createAttribute(localName: string): Attr;
    createAttributeNS(namespace: string | null, qualifiedName: string): Attr;
    createCDATASection(data: string): CDATASection;
    createComment(data: string): Comment;
    createDocumentFragment(): DocumentFragment;
    createElement<K extends keyof HTMLElementTagNameMap>(
        tagName: K,
        options?: ElementCreationOptions,
    ): HTMLElementTagNameMap[K];
    createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(
        tagName: K,
        options?: ElementCreationOptions,
    ): HTMLElementDeprecatedTagNameMap[K];
    createElement(
        tagName: string,
        options?: ElementCreationOptions,
    ): HTMLElement;
    createElementNS(
        namespaceURI: "http://www.w3.org/1999/xhtml",
        qualifiedName: string,
    ): HTMLElement;
    createElementNS<K extends keyof SVGElementTagNameMap>(
        namespaceURI: "http://www.w3.org/2000/svg",
        qualifiedName: K,
    ): SVGElementTagNameMap[K];
    createElementNS(
        namespaceURI: "http://www.w3.org/2000/svg",
        qualifiedName: string,
    ): SVGElement;
    createElementNS<K extends keyof MathMLElementTagNameMap>(
        namespaceURI: "http://www.w3.org/1998/Math/MathML",
        qualifiedName: K,
    ): MathMLElementTagNameMap[K];
    createElementNS(
        namespaceURI: "http://www.w3.org/1998/Math/MathML",
        qualifiedName: string,
    ): MathMLElement;
    createElementNS(
        namespaceURI: string | null,
        qualifiedName: string,
        options?: ElementCreationOptions,
    ): Element;
    createElementNS(
        namespace: string | null,
        qualifiedName: string,
        options?: string | ElementCreationOptions,
    ): Element;
    createEvent(eventInterface: "AnimationEvent"): AnimationEvent;
    createEvent(
        eventInterface: "AnimationPlaybackEvent",
    ): AnimationPlaybackEvent;
    createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent;
    createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent;
    createEvent(eventInterface: "BlobEvent"): BlobEvent;
    createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent;
    createEvent(eventInterface: "CloseEvent"): CloseEvent;
    createEvent(eventInterface: "CommandEvent"): CommandEvent;
    createEvent(eventInterface: "CompositionEvent"): CompositionEvent;
    createEvent(
        eventInterface: "ContentVisibilityAutoStateChangeEvent",
    ): ContentVisibilityAutoStateChangeEvent;
    createEvent(eventInterface: "CookieChangeEvent"): CookieChangeEvent;
    createEvent(eventInterface: "CustomEvent"): CustomEvent;
    createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent;
    createEvent(
        eventInterface: "DeviceOrientationEvent",
    ): DeviceOrientationEvent;
    createEvent(eventInterface: "DragEvent"): DragEvent;
    createEvent(eventInterface: "ErrorEvent"): ErrorEvent;
    createEvent(eventInterface: "Event"): Event;
    createEvent(eventInterface: "Events"): Event;
    createEvent(eventInterface: "FocusEvent"): FocusEvent;
    createEvent(eventInterface: "FontFaceSetLoadEvent"): FontFaceSetLoadEvent;
    createEvent(eventInterface: "FormDataEvent"): FormDataEvent;
    createEvent(
        eventInterface: "GPUUncapturedErrorEvent",
    ): GPUUncapturedErrorEvent;
    createEvent(eventInterface: "GamepadEvent"): GamepadEvent;
    createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent;
    createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent;
    createEvent(eventInterface: "InputEvent"): InputEvent;
    createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent;
    createEvent(eventInterface: "MIDIConnectionEvent"): MIDIConnectionEvent;
    createEvent(eventInterface: "MIDIMessageEvent"): MIDIMessageEvent;
    createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent;
    createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent;
    createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent;
    createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent;
    createEvent(eventInterface: "MessageEvent"): MessageEvent;
    createEvent(eventInterface: "MouseEvent"): MouseEvent;
    createEvent(eventInterface: "MouseEvents"): MouseEvent;
    createEvent(eventInterface: "NavigateEvent"): NavigateEvent;
    createEvent(
        eventInterface: "NavigationCurrentEntryChangeEvent",
    ): NavigationCurrentEntryChangeEvent;
    createEvent(
        eventInterface: "OfflineAudioCompletionEvent",
    ): OfflineAudioCompletionEvent;
    createEvent(eventInterface: "PageRevealEvent"): PageRevealEvent;
    createEvent(eventInterface: "PageSwapEvent"): PageSwapEvent;
    createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent;
    createEvent(
        eventInterface: "PaymentMethodChangeEvent",
    ): PaymentMethodChangeEvent;
    createEvent(
        eventInterface: "PaymentRequestUpdateEvent",
    ): PaymentRequestUpdateEvent;
    createEvent(eventInterface: "PictureInPictureEvent"): PictureInPictureEvent;
    createEvent(eventInterface: "PointerEvent"): PointerEvent;
    createEvent(eventInterface: "PopStateEvent"): PopStateEvent;
    createEvent(eventInterface: "ProgressEvent"): ProgressEvent;
    createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent;
    createEvent(
        eventInterface: "RTCDTMFToneChangeEvent",
    ): RTCDTMFToneChangeEvent;
    createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent;
    createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent;
    createEvent(
        eventInterface: "RTCPeerConnectionIceErrorEvent",
    ): RTCPeerConnectionIceErrorEvent;
    createEvent(
        eventInterface: "RTCPeerConnectionIceEvent",
    ): RTCPeerConnectionIceEvent;
    createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent;
    createEvent(
        eventInterface: "SecurityPolicyViolationEvent",
    ): SecurityPolicyViolationEvent;
    createEvent(
        eventInterface: "SpeechRecognitionErrorEvent",
    ): SpeechRecognitionErrorEvent;
    createEvent(
        eventInterface: "SpeechRecognitionEvent",
    ): SpeechRecognitionEvent;
    createEvent(
        eventInterface: "SpeechSynthesisErrorEvent",
    ): SpeechSynthesisErrorEvent;
    createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent;
    createEvent(eventInterface: "StorageEvent"): StorageEvent;
    createEvent(eventInterface: "SubmitEvent"): SubmitEvent;
    createEvent(
        eventInterface: "TaskPriorityChangeEvent",
    ): TaskPriorityChangeEvent;
    createEvent(eventInterface: "TextEvent"): TextEvent;
    createEvent(eventInterface: "ToggleEvent"): ToggleEvent;
    createEvent(eventInterface: "TouchEvent"): TouchEvent;
    createEvent(eventInterface: "TrackEvent"): TrackEvent;
    createEvent(eventInterface: "TransitionEvent"): TransitionEvent;
    createEvent(eventInterface: "UIEvent"): UIEvent;
    createEvent(eventInterface: "UIEvents"): UIEvent;
    createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent;
    createEvent(eventInterface: "WheelEvent"): WheelEvent;
    createEvent(eventInterface: string): Event;
    createExpression(
        expression: string,
        resolver?: XPathNSResolver | null,
    ): XPathExpression;
    createNodeIterator(
        root: Node,
        whatToShow?: number,
        filter?: NodeFilter | null,
    ): NodeIterator;
    createNSResolver(nodeResolver: Node): Node;
    createProcessingInstruction(
        target: string,
        data: string,
    ): ProcessingInstruction;
    createRange(): Range;
    createTextNode(data: string): Text;
    createTreeWalker(
        root: Node,
        whatToShow?: number,
        filter?: NodeFilter | null,
    ): TreeWalker;
    dispatchEvent(event: Event): boolean;
    elementFromPoint(x: number, y: number): Element | null;
    elementsFromPoint(x: number, y: number): Element[];
    evaluate(
        expression: string,
        contextNode: Node,
        resolver?: XPathNSResolver | null,
        type?: number,
        result?: XPathResult | null,
    ): XPathResult;
    execCommand(commandId: string, showUI?: boolean, value?: string): boolean;
    exitFullscreen(): Promise<void>;
    exitPictureInPicture(): Promise<void>;
    exitPointerLock(): void;
    getAnimations(): Animation[];
    getElementById(elementId: string): HTMLElement | null;
    getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
    getElementsByName(elementName: string): NodeListOf<HTMLElement>;
    getElementsByTagName<K extends keyof HTMLElementTagNameMap>(
        qualifiedName: K,
    ): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
    getElementsByTagName<K extends keyof SVGElementTagNameMap>(
        qualifiedName: K,
    ): HTMLCollectionOf<SVGElementTagNameMap[K]>;
    getElementsByTagName<K extends keyof MathMLElementTagNameMap>(
        qualifiedName: K,
    ): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
    getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(
        qualifiedName: K,
    ): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
    getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
    getElementsByTagNameNS(
        namespaceURI: "http://www.w3.org/1999/xhtml",
        localName: string,
    ): HTMLCollectionOf<HTMLElement>;
    getElementsByTagNameNS(
        namespaceURI: "http://www.w3.org/2000/svg",
        localName: string,
    ): HTMLCollectionOf<SVGElement>;
    getElementsByTagNameNS(
        namespaceURI: "http://www.w3.org/1998/Math/MathML",
        localName: string,
    ): HTMLCollectionOf<MathMLElement>;
    getElementsByTagNameNS(
        namespace: string | null,
        localName: string,
    ): HTMLCollectionOf<Element>;
    getRootNode(options?: GetRootNodeOptions): Node;
    getSelection(): Selection | null;
    hasChildNodes(): boolean;
    hasFocus(): boolean;
    hasStorageAccess(): Promise<boolean>;
    importNode<T extends Node>(
        node: T,
        options?: boolean | ImportNodeOptions,
    ): T;
    insertBefore<T extends Node>(node: T, child: Node | null): T;
    isDefaultNamespace(namespace: string | null): boolean;
    isEqualNode(otherNode: Node | null): boolean;
    isSameNode(otherNode: Node | null): boolean;
    lookupNamespaceURI(prefix: string | null): string | null;
    lookupPrefix(namespace: string | null): string | null;
    moveBefore(node: Node, child: Node | null): void;
    normalize(): void;
    open(unused1?: string, unused2?: string): Document;
    open(url: string | URL, name: string, features: string): Window | null;
    prepend(...nodes: (string | Node)[]): void;
    queryCommandEnabled(commandId: string): boolean;
    queryCommandIndeterm(commandId: string): boolean;
    queryCommandState(commandId: string): boolean;
    queryCommandSupported(commandId: string): boolean;
    queryCommandValue(commandId: string): string;
    querySelector<K extends keyof HTMLElementTagNameMap>(
        selectors: K,
    ): HTMLElementTagNameMap[K] | null;
    querySelector<K extends keyof SVGElementTagNameMap>(
        selectors: K,
    ): SVGElementTagNameMap[K] | null;
    querySelector<K extends keyof MathMLElementTagNameMap>(
        selectors: K,
    ): MathMLElementTagNameMap[K] | null;
    querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(
        selectors: K,
    ): HTMLElementDeprecatedTagNameMap[K] | null;
    querySelector<E extends Element = Element>(selectors: string): E | null;
    querySelectorAll<K extends keyof HTMLElementTagNameMap>(
        selectors: K,
    ): NodeListOf<HTMLElementTagNameMap[K]>;
    querySelectorAll<K extends keyof SVGElementTagNameMap>(
        selectors: K,
    ): NodeListOf<SVGElementTagNameMap[K]>;
    querySelectorAll<K extends keyof MathMLElementTagNameMap>(
        selectors: K,
    ): NodeListOf<MathMLElementTagNameMap[K]>;
    querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(
        selectors: K,
    ): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
    querySelectorAll<E extends Element = Element>(
        selectors: string,
    ): NodeListOf<E>;
    releaseEvents(): void;
    removeChild<T extends Node>(child: T): T;
    removeEventListener<K extends keyof DocumentEventMap>(
        type: K,
        listener: (this: Document, ev: DocumentEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
    replaceChild<T extends Node>(node: Node, child: T): T;
    replaceChildren(...nodes: (string | Node)[]): void;
    requestStorageAccess(): Promise<void>;
    startViewTransition(
        callbackOptions?:
            | ViewTransitionUpdateCallback
            | StartViewTransitionOptions,
    ): ViewTransition;
    write(...text: string[]): void;
    writeln(...text: string[]): void;
}

Hierarchy (View Summary)

Index
activeElement activeViewTransition adoptedStyleSheets alinkColor all anchors applets ATTRIBUTE_NODE baseURI bgColor body CDATA_SECTION_NODE characterSet charset childElementCount childNodes children COMMENT_NODE compatMode contentType cookie currentScript customElementRegistry defaultView designMode dir doctype DOCUMENT_FRAGMENT_NODE DOCUMENT_NODE DOCUMENT_POSITION_CONTAINED_BY DOCUMENT_POSITION_CONTAINS DOCUMENT_POSITION_DISCONNECTED DOCUMENT_POSITION_FOLLOWING DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC DOCUMENT_POSITION_PRECEDING DOCUMENT_TYPE_NODE documentElement documentURI domain ELEMENT_NODE embeds ENTITY_NODE ENTITY_REFERENCE_NODE fgColor firstChild firstElementChild fonts forms fragmentDirective fullscreen fullscreenElement fullscreenEnabled head hidden images implementation inputEncoding isConnected lastChild lastElementChild lastModified linkColor links nextSibling nodeName nodeType nodeValue NOTATION_NODE onabort onanimationcancel onanimationend onanimationiteration onanimationstart onauxclick onbeforeinput onbeforematch onbeforetoggle onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncommand oncontextlost oncontextmenu oncontextrestored oncopy oncuechange oncut ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformdata onfullscreenchange onfullscreenerror ongotpointercapture oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart onlostpointercapture onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover onmouseup onpaste onpause onplay onplaying onpointercancel onpointerdown onpointerenter onpointerleave onpointerlockchange onpointerlockerror onpointermove onpointerout onpointerover onpointerrawupdate onpointerup onprogress onratechange onreadystatechange onreset onresize onscroll onscrollend onsecuritypolicyviolation onseeked onseeking onselect onselectionchange onselectstart onslotchange onstalled onsubmit onsuspend ontimeupdate ontoggle ontouchcancel? ontouchend? ontouchmove? ontouchstart? ontransitioncancel ontransitionend ontransitionrun ontransitionstart onvisibilitychange onvolumechange onwaiting onwebkitanimationend onwebkitanimationiteration onwebkitanimationstart onwebkittransitionend onwheel ownerDocument parentElement parentNode pictureInPictureElement pictureInPictureEnabled plugins pointerLockElement previousSibling PROCESSING_INSTRUCTION_NODE readyState referrer rootElement scripts scrollingElement styleSheets TEXT_NODE timeline title URL visibilityState vlinkColor
activeElement: Element | null

Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document.

For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document.

Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not.

MDN Reference

activeViewTransition: ViewTransition | null

The activeViewTransition read-only property of the Document interface returns a ViewTransition instance representing the view transition currently active on the document.

MDN Reference

adoptedStyleSheets: CSSStyleSheet[]
alinkColor: string

Returns or sets the color of an active link in the document body. A link is active during the time between mousedown and mouseup events.

MDN Reference

The Document interface's read-only all property returns an HTMLAllCollection rooted at the document node.

MDN Reference

The anchors read-only property of the Document interface returns a list of all of the anchors in the document.

MDN Reference

The applets property of the Document returns an empty HTMLCollection. This property is kept only for compatibility reasons; in older versions of browsers, it returned a list of the applets within a document.

MDN Reference

ATTRIBUTE_NODE: 2
baseURI: string

The read-only baseURI property of the Node interface returns the absolute base URL of the document containing the node.

MDN Reference

bgColor: string

The deprecated bgColor property gets or sets the background color of the current document.

MDN Reference

The Document.body property represents the or node of the current document, or null if no such element exists.

MDN Reference

CDATA_SECTION_NODE: 4

node is a CDATASection node.

characterSet: string

The Document.characterSet read-only property returns the character encoding of the document that it's currently rendered with.

MDN Reference

charset: string

This is a legacy alias of characterSet.

MDN Reference

childElementCount: number
childNodes: NodeListOf<ChildNode>

The read-only childNodes property of the Node interface returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. Child nodes include elements, text and comments.

MDN Reference

children: HTMLCollection

Returns the child elements.

MDN Reference

COMMENT_NODE: 8

node is a Comment node.

compatMode: string

The Document.compatMode read-only property indicates whether the document is rendered in Quirks mode or Standards mode.

MDN Reference

contentType: string

The Document.contentType read-only property returns the MIME type that the document is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions.

MDN Reference

cookie: string

The Document property cookie lets you read and write cookies associated with the document. It serves as a getter and setter for the actual values of the cookies.

MDN Reference

currentScript: HTMLOrSVGScriptElement | null

The Document.currentScript property returns the

Was this helpful?