@mathjax/src
    Preparing search index...

    Interface DOMAdaptor<N, T, D>

    The interface for the DOMAdaptor

    interface DOMAdaptor<N, T, D> {
        canMeasureNodes: boolean;
        document: D;
        addClass(node: N, name: string): void;
        allAttributes(node: N): AttributeData[];
        allClasses(node: N): string[];
        allStyles(node: N): string;
        append(node: N, child: N | T): N | T;
        body(doc?: D): N;
        childNode(node: N, i: number): N | T;
        childNodes(node: N): (N | T)[];
        clone(node: N, deep?: boolean): N;
        contains(container: N, node: N | T): boolean;
        createWorker(
            listener: (event: any) => void,
            options: OptionList,
        ): Promise<minWorker>;
        cssText(node: N): string;
        doctype(doc?: D): string;
        firstChild(node: N): N | T;
        fontFamily(node: N): string;
        fontSize(node: N): number;
        getAttribute(node: N, name: string): string;
        getElement(selector: string, node?: N | D): N;
        getElements(nodes: (string | N | N[])[], document: D): N[];
        getProperty(node: N, name: string): any;
        getStyle(node: N, name: string): string;
        hasAttribute(node: N, name: string): boolean;
        hasClass(node: N, name: string): boolean;
        head(doc?: D): N;
        innerHTML(node: N): string;
        insert(nchild: N | T, ochild: N | T): void;
        insertRules(node: N, rules: string[]): void;
        kind(node: N | T): string;
        lastChild(node: N): N | T;
        next(node: N | T): N | T;
        node(kind: string, def?: OptionList, children?: (N | T)[], ns?: string): N;
        nodeBBox(node: N): PageBBox;
        nodeSize(node: N, em?: number, local?: boolean): [number, number];
        outerHTML(node: N): string;
        parent(node: N | T): N;
        parse(text: string, format?: string): D;
        previous(node: N | T): N | T;
        remove(child: N | T): N | T;
        removeAttribute(node: N, name: string): void;
        removeClass(node: N, name: string): void;
        replace(nnode: N | T, onode: N | T): N | T;
        root(doc?: D): N;
        serializeXML(node: N): string;
        setAttribute(
            node: N,
            name: string,
            value: string | number,
            ns?: string,
        ): void;
        setAttributes(node: N, def: OptionList): void;
        setProperty(node: N, name: string, value: any): void;
        setStyle(node: N, name: string, value: string): void;
        split(node: T, n: number): T;
        tags(node: N, name: string, ns?: string): N[];
        text(text: string): T;
        textContent(node: N): string;
        value(node: N | T): string;
    }

    Type Parameters

    • N

      The HTMLElement node class

    • T

      The Text node class

    • D

      The Document class

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    canMeasureNodes: boolean

    True when the adaptor can measure DOM node sizes

    document: D

    Document in which the nodes are to be created

    Methods

    • Parameters

      • node: N

        The HTML node whose class is to be augmented

      • name: string

        The class to be added

      Returns void

    • Parameters

      • node: N

        The HTML node whose class list is needed

      Returns string[]

      An array of the class names for this node

    • Parameters

      • node: N

        The HTML node whose styles are to be returned

      Returns string

      The cssText for the styles

    • Parameters

      • node: N

        The HTML node to be appended to

      • child: N | T

        The node or text to be appended

      Returns N | T

      The appended node

    • Parameters

      • Optionaldoc: D

        The document whose body is to be obtained

      Returns N

      The document.body element

    • Parameters

      • node: N

        The HTML node whose child is to be obtained

      • i: number

        The index of the child to return

      Returns N | T

      The i-th child node of the given node (or null)

    • Parameters

      • node: N

        The HTML node whose children are to be obtained

      Returns (N | T)[]

      Array of children for the given node (not a live list)

    • Parameters

      • node: N

        The HTML node to be cloned

      • Optionaldeep: boolean

        True if children should be cloned

      Returns N

      The copied node

    • Determine if a container node contains a given node somewhere in its DOM tree

      Parameters

      • container: N

        The container to search

      • node: N | T

        The node to look for

      Returns boolean

      True if the node is in the container's DOM tree

    • Parameters

      • listener: (event: any) => void

        The event listener for messages from the worker

      • options: OptionList

        The worker options (for path and worker name)

      Returns Promise<minWorker>

      A promise for the worker instance that was created

    • Parameters

      • node: N

        The stylesheet node whose rules are to be returned

      Returns string

      The string version of the stylesheet rules

    • Parameters

      • Optionaldoc: D

        The document whose doctype is to be obtained

      Returns string

      The DOCTYPE comment

    • Parameters

      • node: N

        The HTML node whose child is to be obtained

      Returns N | T

      The first child of the given node (or null)

    • Parameters

      • node: N

        The HTML node whose font family is to be determined

      Returns string

      The font family

    • Parameters

      • node: N

        The HTML node whose font size is to be determined

      Returns number

      The font size (in pixels) of the node

    • Parameters

      • node: N

        The HTML node whose attribute is to be obtained

      • name: string

        The name of the attribute to get

      Returns string

      The value of the given attribute of the given node

    • Get an element specified by CSS selector.

      Parameters

      • selector: string

        The selector to locate

      • Optionalnode: N | D

        The document or element in which to search

      Returns N

      The first matching element

    • Get a list of containers (to be searched for math). These can be specified by CSS selector, or as actual DOM elements or arrays of such.

      Parameters

      • nodes: (string | N | N[])[]

        The array of items to make into a container list

      • document: D

        The document in which to search

      Returns N[]

      The array of containers to search

    • Parameters

      • node: N

        The HTML node whose property is to be retrieved

      • name: string

        The property to get

      Returns any

      The property's value

    • Parameters

      • node: N

        The HTML node whose style is to be obtained

      • name: string

        The style to be obtained

      Returns string

      The value of the style

    • Parameters

      • node: N

        The HTML node whose attribute is to be tested

      • name: string

        The name of the attribute to test

      Returns boolean

      True of the node has the given attribute defined

    • Parameters

      • node: N

        The HTML node whose class is to be tested

      • name: string

        The class to test

      Returns boolean

      True if the node has the given class

    • Parameters

      • Optionaldoc: D

        The document whose head is to be obtained

      Returns N

      The document.head element

    • Parameters

      • node: N

        The HTML node whose inner HTML string is to be obtained

      Returns string

      The serialized content of the node

    • Parameters

      • nchild: N | T

        The node or text to be inserted

      • ochild: N | T

        The node or text where the new child is to be added before it

      Returns void

    • Parameters

      • node: N

        The stylesheet node where the rule will be added

      • rules: string[]

        The rule to add at the beginning of the stylesheet

      Returns void

    • Parameters

      • node: N | T

        The HTML node whose tag or node name is to be obtained

      Returns string

      The tag or node name of the given node

    • Parameters

      • node: N

        The HTML node whose child is to be obtained

      Returns N | T

      The last child of the given node (or null)

    • Parameters

      • node: N | T

        The HTML node whose sibling is to be obtained

      Returns N | T

      The node following the given one (or null)

    • Parameters

      • kind: string

        The tag name of the HTML node to be created

      • Optionaldef: OptionList

        The properties to set for the created node

      • Optionalchildren: (N | T)[]

        The child nodes for the created HTML node

      • Optionalns: string

        The namespace in which to create the node

      Returns N

      The generated HTML tree

    • Parameters

      • node: N

        The HTML node whose dimensions are to be determined

      • Optionalem: number

        The number of pixels in an em

      • Optionallocal: boolean

        True if local coordinates are to be used in SVG elements

      Returns [number, number]

      The width and height (in ems) of the element

    • Parameters

      • node: N

        The HTML node whose outer HTML string is to be obtained

      Returns string

      The serialized node and its content

    • Parameters

      • node: N | T

        The HTML node whose parent is to be obtained

      Returns N

      The parent node of the given one

    • Parameters

      • text: string

        The serialized document to be parsed

      • Optionalformat: string

        The format (e.g., 'text/html' or 'text/xhtml')

      Returns D

      The parsed document

    • Parameters

      • node: N | T

        The HTML node whose sibling is to be obtained

      Returns N | T

      The node preceding the given one (or null)

    • Parameters

      • node: N

        The HTML node whose attribute is to be removed

      • name: string

        The name of the attribute to remove

      Returns void

    • Parameters

      • node: N

        The HTML node whose class is to be changed

      • name: string

        The class to be removed

      Returns void

    • Parameters

      • nnode: N | T

        The node to replace with

      • onode: N | T

        The child to be replaced

      Returns N | T

      The removed node

    • Parameters

      • Optionaldoc: D

        The document whose documentElement is to be obtained

      Returns N

      The documentElement

    • Parameters

      • node: N

        The HTML node whose serialized string is to be obtained

      Returns string

      The serialized node and its content

    • Parameters

      • node: N

        The HTML node whose attribute is to be set

      • name: string

        The name of the attribute to set

      • value: string | number

        The new value of the attribute

      • Optionalns: string

        The namespace to use for the attribute

      Returns void

    • Parameters

      • node: N

        The HTML node whose property is to be set

      • name: string

        The property to set

      • value: any

        The property's new value

      Returns void

    • Parameters

      • node: N

        The HTML node whose style is to be changed

      • name: string

        The style to be set

      • value: string

        The new value of the style

      Returns void

    • Parameters

      • node: T

        The HTML text node to be split

      • n: number

        The index of the character where the split will occur

      Returns T

    • Parameters

      • node: N

        The node to search for tags

      • name: string

        The name of the tag to search for

      • Optionalns: string

        The namespace to search in (or null for no namespace)

      Returns N[]

      The list of tags found

    • Parameters

      • text: string

        The text from which to create an HTML text node

      Returns T

      The generated text node with the given text

    • Parameters

      • node: N

        The HTML node whose text content is to be obtained

      Returns string

      The text content of the given node

    • Parameters

      • node: N | T

        The HTML node whose value is to be obtained

      Returns string

      The value of the given node