/** * @file * * Mocks of the child-management and element-creation helpers Obsidian adds to `Node.prototype`. */ import type { SvgElementInfo } from '../internal/types.mjs'; /** * Appends a text node to this node. * * @param value - The text to append. */ export declare function appendText(this: Node, value: string): void; /** * Creates a `
` and appends it to this node, as {@link createEl} does. * * @param o - A class name, or the element's options; the parent is always this node. * @param callback - Called with the new element before it is returned. * @returns The new `
`. */ export declare function createDiv(this: Node, o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElement; /** * Creates an element and appends it to this node, or prepends it when `o.prepend` is set. * * @typeParam K - The tag name. * @param tag - The tag name of the element to create. * @param o - A class name, or the element's options; any `parent` given there is replaced by this node. * @param callback - Called with the new element before it is returned. * @returns The new element. */ export declare function createEl(this: Node, tag: K, o?: DomElementInfo | string, callback?: (el: HTMLElementTagNameMap[K]) => void): HTMLElementTagNameMap[K]; /** * Creates a `` and appends it to this node, as {@link createEl} does. * * @param o - A class name, or the element's options; the parent is always this node. * @param callback - Called with the new element before it is returned. * @returns The new ``. */ export declare function createSpan(this: Node, o?: DomElementInfo | string, callback?: (el: HTMLSpanElement) => void): HTMLSpanElement; /** * Creates an SVG element in the SVG namespace and appends it to this node, or prepends it when `o.prepend` is set. * * @typeParam K - The SVG tag name. * @param tag - The tag name of the SVG element to create. * @param o - A class name, or the element's options; any `parent` given there is replaced by this node. * @param callback - Called with the new element before it is returned. * @returns The new SVG element. */ export declare function createSvg(this: Node, tag: K, o?: string | SvgElementInfo, callback?: (el: SVGElementTagNameMap[K]) => void): SVGElementTagNameMap[K]; /** * Removes this node from its parent; does nothing when it has none. */ export declare function detach(this: Node): void; /** * Removes all of this node's children, last first, as Obsidian does. */ export declare function empty(this: Node): void; /** * Gets the position of a node among this node's children. * * @param other - The child node to locate. * @returns The index of `other` among this node's child nodes, or `-1` when it is not a child of this node. */ export declare function indexOf(this: Node, other: Node): number; /** * Inserts a node into this node right after a reference child, or as the first child when there is no reference child. * * @typeParam T - The inserted node's type. * @param node - The node to insert. * @param child - The child of this node to insert after, or `null` to insert `node` first. * @returns The inserted node. */ export declare function insertAfter(this: Node, node: T, child: Node | null): T; /** * Cross-window `instanceof` check for DOM nodes. The mock has a single window, so it is a plain `instanceof`. * * @typeParam T - The instance type to narrow to. * @param type - The constructor to check against. * @returns `true` when this node is an instance of `type`. */ export declare function instanceOf(this: Node, type: new () => T): this is T; /** * Replaces this node's children with the given nodes, in order. A node that is already a child in the right place stays * attached; only the unwanted children are removed and only the misplaced nodes are inserted, as Obsidian does. * * @param children - The new child nodes. */ export declare function setChildrenInPlace(this: Node, children: Node[]): void;