import INode from './INode'; import IElement from '../element/IElement'; /** * Node utility. */ export default class NodeUtility { /** * Returns boolean indicating if nodeB is an inclusive ancestor of nodeA. * * Based on: * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js * * @see https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor * @param ancestorNode Ancestor node. * @param referenceNode Reference node. * @returns "true" if following. */ static isInclusiveAncestor(ancestorNode: INode, referenceNode: INode): boolean; /** * Returns boolean indicating if nodeB is following nodeA in the document tree. * * Based on: * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js * * @see https://dom.spec.whatwg.org/#concept-tree-following * @param nodeA Node A. * @param nodeB Node B. * @returns "true" if following. */ static isFollowing(nodeA: INode, nodeB: INode): boolean; /** * Node length. * * Based on: * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js * * @see https://dom.spec.whatwg.org/#concept-node-length * @param node Node. * @returns Node length. */ static getNodeLength(node: INode): number; /** * Returns boolean indicating if nodeB is following nodeA in the document tree. * * Based on: * https://github.com/jsdom/js-symbol-tree/blob/master/lib/SymbolTree.js#L220 * * @param node Node. * @param [root] Root. * @returns Following node. */ static following(node: INode, root?: INode): INode; /** * Returns the next sibling or parents sibling. * * @param node Node. * @returns Next decentant node. */ static nextDecendantNode(node: INode): INode; /** * Needed by https://dom.spec.whatwg.org/#concept-node-equals * * @param elementA * @param elementB */ static attributeListsEqual(elementA: IElement, elementB: IElement): boolean; /** * Check if node nodeA equals node nodeB. * Reference: https://dom.spec.whatwg.org/#concept-node-equals * * @param nodeA Node A. * @param nodeB Node B. */ static isEqualNode(nodeA: INode, nodeB: INode): boolean; }