import type { Func, UpdatePayload } from '../interface/index.js'; import type { Document } from './document.js'; import type { Element } from './element.js'; import { EventTarget } from './event-target.js'; import { NodeType } from './node_types.js'; import type { RootElement } from './root.js'; interface RemoveChildOptions { cleanRef?: boolean; doUpdate?: boolean; } export declare class Node extends EventTarget { uid: string; sid: string; nodeType: NodeType; nodeName: string; parentNode: Node | null; childNodes: Node[]; constructor(); private hydrate; private updateChildNodes; get _root(): RootElement | null; protected findIndex(refChild: Node): number; get _path(): string; get nextSibling(): Node | null; get previousSibling(): Node | null; get parentElement(): Element | null; get firstChild(): Node | null; get lastChild(): Node | null; /** * @textContent 目前只能置空子元素 * @TODO 等待完整 innerHTML 实现 */ set textContent(text: string); /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore * @scenario * [A,B,C] * 1. insert D before C, D has no parent * 2. insert D before C, D has the same parent of C * 3. insert D before C, D has the different parent of C */ insertBefore(newChild: T, refChild?: Node | null, isReplace?: boolean): T; /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/appendChild * @scenario * [A,B,C] * 1. append C, C has no parent * 2. append C, C has the same parent of B * 3. append C, C has the different parent of B */ appendChild(newChild: Node): Node; /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild * @scenario * [A,B,C] * 1. replace B with C, C has no parent * 2. replace B with C, C has no parent, C has the same parent of B * 3. replace B with C, C has no parent, C has the different parent of B */ replaceChild(newChild: Node, oldChild: Node): Node; /** * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/removeChild * @scenario * [A,B,C] * 1. remove A or B * 2. remove C */ removeChild(child: T, options?: RemoveChildOptions): T; remove(options?: RemoveChildOptions): void; hasChildNodes(): boolean; enqueueUpdate(payload: UpdatePayload): void; get ownerDocument(): Document; static extend(methodName: string, options: Func | Record): void; } export {};