### DOM Traversal Utilities Source: https://domutils.js.org/functions/getSiblings Provides functions for navigating the DOM tree, including getting parent elements, children, and element names. Also includes methods for checking attributes and finding next/previous elements. ```javascript /** * Gets the parent of an element. * @param {AnyNode} elem * @returns {AnyNode | null} */ function getParent(elem) { // ... } /** * Gets the children of an element. * @param {AnyNode} elem * @returns {AnyNode[]} */ function getChildren(elem) { // ... } /** * Gets the name of an element. * @param {AnyNode} elem * @returns {string} */ function getName(elem) { // ... } /** * Checks if an element has a specific attribute. * @param {AnyNode} elem * @param {string} name * @returns {boolean} */ function hasAttrib(elem, name) { // ... } /** * Gets the next element sibling. * @param {AnyNode} elem * @returns {AnyNode | null} */ function nextElementSibling(elem) { // ... } /** * Gets the previous element sibling. * @param {AnyNode} elem * @returns {AnyNode | null} */ function prevElementSibling(elem) { // ... } ``` -------------------------------- ### DOM Traversal Utilities Source: https://domutils.js.org/functions/hasAttrib Provides functions for navigating and inspecting the DOM tree, including getting attribute values, children, parent elements, and siblings. ```javascript // getAttributeValue(elem: Element, name: string): string | null // getChildren(elem: Element): Element[] // getName(elem: Element): string // getParent(elem: Element): Element | null // getSiblings(elem: Element): Element[] // hasAttrib(elem: Element, name: string): boolean // nextElementSibling(elem: Element): Element | null // prevElementSibling(elem: Element): Element | null ``` -------------------------------- ### DOM Traversal Utilities - domutils.js Source: https://domutils.js.org/functions/textContent Includes functions for traversing the DOM tree, such as getting attributes, children, parents, siblings, and checking for attributes. These are essential for navigating the DOM structure. ```javascript getAttributeValue(node: AnyNode, attribute: string): string | null getChildren(node: AnyNode): AnyNode[] getName(node: AnyNode): string | null getParent(node: AnyNode): AnyNode | null getSiblings(node: AnyNode): AnyNode[] hasAttrib(node: AnyNode, attribute: string): boolean nextElementSibling(node: AnyNode): AnyNode | null prevElementSibling(node: AnyNode): AnyNode | null ``` -------------------------------- ### DOM Legacy Query Functions Source: https://domutils.js.org/functions/getSiblings Provides older methods for querying the DOM, including getting elements by ID, class name, and tag name. Also includes a utility for testing elements against specific criteria. ```javascript /** * Gets an element by its ID. * @param {string} id * @returns {AnyNode | null} */ function getElementById(id) { // ... } /** * Gets all elements matching a CSS selector. * @param {string} selector * @returns {AnyNode[]} */ function getElements(selector) { // ... } /** * Gets all elements with a specific class name. * @param {string} className * @returns {AnyNode[]} */ function getElementsByClassName(className) { // ... } /** * Gets all elements with a specific tag name. * @param {string} tagName * @returns {AnyNode[]} */ function getElementsByTagName(tagName) { // ... } /** * Gets all elements with a specific tag type. * @param {string} tagType * @returns {AnyNode[]} */ function getElementsByTagType(tagType) { // ... } /** * Tests if an element matches certain criteria. * @param {AnyNode} elem * @param {TestElementOpts} opts * @returns {boolean} */ function testElement(elem, opts) { // ... } /** * Options for testing elements. * @typedef {object} * @property {string} [id] * @property {string} [className] * @property {string} [tagName] */ // type TestElementOpts = { id?: string; className?: string; tagName?: string; } ``` -------------------------------- ### DOM Traversal Functions Source: https://domutils.js.org/functions/compareDocumentPosition Functions for traversing the DOM tree, including getting attribute values, children, parent, and siblings. ```javascript function getAttributeValue(element: HTMLElement, attributeName: string): string | null; function getChildren(element: HTMLElement): NodeListOf; function getName(element: HTMLElement): string; function getParent(element: HTMLElement): HTMLElement | null; function getSiblings(element: HTMLElement): HTMLElement[]; function hasAttrib(element: HTMLElement, attributeName: string): boolean; function nextElementSibling(element: HTMLElement): HTMLElement | null; function prevElementSibling(element: HTMLElement): HTMLElement | null; ``` -------------------------------- ### DOM Traversal Functions Source: https://domutils.js.org/modules Functions for navigating the DOM tree, including getting parent, children, siblings, and checking for attributes or specific element types. ```javascript getAttributeValue(element, attributeName) getChildren(element) getName(element) getParent(element) getSiblings(element) hasAttrib(element, attributeName) nextElementSibling(element) prevElementSibling(element) ``` -------------------------------- ### domutils Traversal Functions Source: https://domutils.js.org/functions/find Functions for traversing the DOM tree, such as getting attributes, children, parents, and siblings. ```javascript getAttributeValue(element: AnyNode, attributeName: string): string | null getChildren(element: AnyNode): AnyNode[] getName(element: AnyNode): string getParent(element: AnyNode): AnyNode | null getSiblings(element: AnyNode): AnyNode[] hasAttrib(element: AnyNode, attributeName: string): boolean nextElementSibling(element: AnyNode): AnyNode | null prevElementSibling(element: AnyNode): AnyNode | null ``` -------------------------------- ### domutils.js: Traversal Functions Source: https://domutils.js.org/functions/getChildren Functions for traversing the DOM tree, including getting attribute values, children, parent nodes, and siblings. ```javascript getAttributeValue getChildren getName getParent getSiblings hasAttrib nextElementSibling prevElementSibling ``` -------------------------------- ### domutils.js: Feed Utilities Source: https://domutils.js.org/functions/getChildren Provides utility functions for working with feeds, including getting feed data and managing feed items. Includes types like Feed, FeedItem, FeedItemMedia, etc. ```javascript Feed FeedItem FeedItemMedia FeedItemMediaExpression FeedItemMediaMedium getFeed ``` -------------------------------- ### DOM Utilities - Legacy Query Functions Source: https://domutils.js.org/functions/getElements Provides legacy functions for querying the DOM, including getting elements by ID, class name, tag name, and tag type. Also includes a function to test elements against specific criteria and the associated options type. ```APIDOC getElementById(id: string, nodes?: AnyNode | AnyNode[], recurse?: boolean): AnyNode | null - Retrieves an element by its ID. getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[] - Retrieves elements based on provided options. getElementsByClassName(className: string, nodes?: AnyNode | AnyNode[], recurse?: boolean): AnyNode[] - Retrieves elements by their class name. getElementsByTagName(tagName: string, nodes?: AnyNode | AnyNode[], recurse?: boolean): AnyNode[] - Retrieves elements by their tag name. getElementsByTagType(tagType: string, nodes?: AnyNode | AnyNode[], recurse?: boolean): AnyNode[] - Retrieves elements by their tag type. testElement(element: AnyNode, options: TestElementOpts): boolean - Tests if an element matches the given options. TestElementOpts: { id?: string; className?: string; tagName?: string; attributes?: { [key: string]: string }; // ... other potential options } ``` -------------------------------- ### Get Elements by Options Source: https://domutils.js.org/functions/getElements Retrieves all DOM nodes that match the specified options. It can search within a given set of nodes and optionally recurse into child nodes. A limit can be set for the maximum number of nodes to return. ```javascript getElements( options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number, ): AnyNode[] ``` -------------------------------- ### DOM Utilities - Traversal Functions Source: https://domutils.js.org/functions/getElements Offers functions for traversing the DOM tree, including getting attribute values, children, parent nodes, and siblings. Also includes functions to check for attributes and navigate to adjacent elements. ```APIDOC getAttributeValue(element: AnyNode, attributeName: string): string | null - Gets the value of a specified attribute for an element. getChildren(element: AnyNode): AnyNode[] - Gets all direct children of an element. getName(element: AnyNode): string - Gets the name of an element (e.g., tag name). getParent(element: AnyNode): AnyNode | null - Gets the parent node of an element. getSiblings(element: AnyNode): AnyNode[] - Gets all sibling elements of a given element. hasAttrib(element: AnyNode, attributeName: string): boolean - Checks if an element has a specified attribute. nextElementSibling(element: AnyNode): AnyNode | null - Gets the next sibling element. prevElementSibling(element: AnyNode): AnyNode | null - Gets the previous sibling element. ``` -------------------------------- ### domutils API Documentation Source: https://domutils.js.org/functions/testElement This section outlines various functionalities within the domutils library, including feed management, helper functions, legacy query functions, manipulation methods, querying utilities, stringify operations, and traversal methods. ```APIDOC domutils: Feeds: Feed FeedItem FeedItemMedia FeedItemMediaExpression FeedItemMediaMedium getFeed Helpers: compareDocumentPosition DocumentPosition removeSubsets uniqueSort Legacy Query Functions: getElementById(id: string): HTMLElement | null getElements(selector: string): NodeListOf getElementsByClassName(className: string): HTMLCollectionOf getElementsByTagName(tagName: string): HTMLCollectionOf getElementsByTagType(tagType: string): HTMLCollectionOf testElement(options: TestElementOpts, node: AnyNode): boolean TestElementOpts Manipulation: append(node: HTMLElement, target: HTMLElement): void appendChild(node: HTMLElement, parent: HTMLElement): void prepend(node: HTMLElement, target: HTMLElement): void prependChild(node: HTMLElement, parent: HTMLElement): void removeElement(node: HTMLElement): void replaceElement(newNode: HTMLElement, oldNode: HTMLElement): void Querying: existsOne(predicate: (node: Element) => boolean, nodes: NodeListOf): boolean filter(predicate: (node: Element) => boolean, nodes: NodeListOf): Element[] find(selector: string, context?: Element): Element | null findAll(selector: string, context?: Element): NodeListOf findOne(selector: string, context?: Element): Element | null findOneChild(selector: string, parent: Element): Element | null Stringify: getInnerHTML(node: HTMLElement): string getOuterHTML(node: HTMLElement): string getText(node: HTMLElement): string innerText(node: HTMLElement): string textContent(node: HTMLElement): string Traversal: getAttributeValue(node: HTMLElement, attributeName: string): string | null getChildren(node: HTMLElement): HTMLElement[] getName(node: HTMLElement): string getParent(node: HTMLElement): HTMLElement | null getSiblings(node: HTMLElement): HTMLElement[] hasAttrib(node: HTMLElement, attributeName: string): boolean nextElementSibling(node: HTMLElement): HTMLElement | null prevElementSibling(node: HTMLElement): HTMLElement | null ``` -------------------------------- ### DOM Traversal - Get Attribute Value Source: https://domutils.js.org/functions/getSiblings Retrieves the value of a specified attribute from a DOM element. ```javascript /** * Gets the value of an attribute from an element. * @param {AnyNode} elem * @param {string} name * @returns {string | null} */ function getAttributeValue(elem, name) { // ... } ``` -------------------------------- ### Helper Functions Source: https://domutils.js.org/functions/compareDocumentPosition Provides utility functions such as node comparison, document position constants, subset removal, and unique sorting. ```javascript function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number; const DocumentPosition: { [key: string]: number }; function removeSubsets(nodes: Node[]): Node[]; function uniqueSort(nodes: Node[]): Node[]; ``` -------------------------------- ### Feed Utilities Source: https://domutils.js.org/functions/compareDocumentPosition Utilities for working with feeds, including feed structures and functions to retrieve feed data. ```javascript class Feed {} class FeedItem {} class FeedItemMedia {} class FeedItemMediaExpression {} class FeedItemMediaMedium {} function getFeed(url: string): Feed | null; ``` -------------------------------- ### domutils Stringify Functions Source: https://domutils.js.org/functions/getInnerHTML Provides functions for stringifying DOM nodes, including getting inner HTML, outer HTML, and text content. ```javascript // getInnerHTML is deprecated, use dom-serializer directly // getOuterHTML // getText // innerText // textContent ``` -------------------------------- ### Feed Utilities Source: https://domutils.js.org/functions/getSiblings Provides utilities for working with RSS or Atom feeds, including structures for feed items and a function to retrieve feed data. ```javascript /** * Represents a media item in a feed. */ // interface FeedItemMedia { // medium?: string; // expression?: string; // type?: string; // url: string; // } /** * Represents a single item in a feed. */ // interface FeedItem { // title: string; // url: string; // media?: FeedItemMedia[]; // // ... other properties // } /** * Represents a feed. */ // interface Feed { // title: string; // items: FeedItem[]; // } /** * Retrieves feed data. * @param {string} url The URL of the feed. * @returns {Promise} */ // async function getFeed(url: string): Promise { // // ... // } ``` -------------------------------- ### domutils Querying Functions Source: https://domutils.js.org/functions/find Provides various functions for querying the DOM, including finding single elements, all matching elements, and checking for existence. ```javascript existsOne(test: (elem: AnyNode) => boolean, nodes: ParentNode | AnyNode[]): boolean filter(test: (elem: AnyNode) => boolean, nodes: ParentNode | AnyNode[]): AnyNode[] find(test: (elem: AnyNode) => boolean, nodes: ParentNode | AnyNode[], recurse: boolean, limit: number): AnyNode[] findAll(test: (elem: AnyNode) => boolean, nodes: ParentNode | AnyNode[]): AnyNode[] findOne(test: (elem: AnyNode) => boolean, nodes: ParentNode | AnyNode[]): AnyNode | null findOneChild(test: (elem: AnyNode) => boolean, parent: ParentNode): AnyNode | null ``` -------------------------------- ### Get Element Name - domutils Source: https://domutils.js.org/functions/getName Retrieves the tag name of a given DOM element. This function is part of the traversal utilities in the domutils library. ```javascript /** * Get the tag name of an element. * @param {Element} elem The element to get the name for. * @returns {string} The tag name of elem. */ getName(elem: Element): string; ``` -------------------------------- ### DOM Querying Utilities Source: https://domutils.js.org/functions/getSiblings Offers functions for querying the DOM, such as checking for the existence of elements, filtering collections, and finding specific elements based on various criteria. ```javascript /** * Checks if at least one element in a collection matches a test function. * @param {AnyNode[]} elems * @param {(elem: AnyNode) => boolean} test * @returns {boolean} */ function existsOne(elems, test) { // ... } /** * Filters a collection of elements based on a test function. * @param {AnyNode[]} elems * @param {(elem: AnyNode) => boolean} test * @returns {AnyNode[]} */ function filter(elems, test) { // ... } /** * Finds the first element in a collection that matches a test function. * @param {AnyNode[]} elems * @param {(elem: AnyNode) => boolean} test * @returns {AnyNode | null} */ function find(elems, test) { // ... } /** * Finds all elements in a collection that match a test function. * @param {AnyNode[]} elems * @param {(elem: AnyNode) => boolean} test * @returns {AnyNode[]} */ function findAll(elems, test) { // ... } /** * Finds the first element matching a selector. * @param {string} selector * @param {AnyNode} [context=document] * @returns {AnyNode | null} */ function findOne(selector, context) { // ... } /** * Finds the first child element matching a selector. * @param {AnyNode} parent * @param {string} selector * @returns {AnyNode | null} */ function findOneChild(parent, selector) { // ... } ``` -------------------------------- ### DOM Manipulation Utilities Source: https://domutils.js.org/functions/getSiblings Provides functions for manipulating the DOM, including appending, prepending, removing, and replacing elements. These utilities simplify common DOM modification tasks. ```javascript /** * Appends a new element to the end of a parent element. * @param {AnyNode} parent * @param {AnyNode} newNode */ function append(parent, newNode) { // ... } /** * Appends a new node as the last child of a parent node. * @param {AnyNode} parent * @param {AnyNode} newNode */ function appendChild(parent, newNode) { // ... } /** * Prepends a new element to the beginning of a parent element. * @param {AnyNode} parent * @param {AnyNode} newNode */ function prepend(parent, newNode) { // ... } /** * Prepends a new node as the first child of a parent node. * @param {AnyNode} parent * @param {AnyNode} newNode */ function prependChild(parent, newNode) { // ... } /** * Removes an element from the DOM. * @param {AnyNode} elem */ function removeElement(elem) { // ... } /** * Replaces an old element with a new element in the DOM. * @param {AnyNode} oldElem * @param {AnyNode} newElem */ function replaceElement(oldElem, newElem) { // ... } ``` -------------------------------- ### Get Parent Node - domutils.js Source: https://domutils.js.org/functions/getParent Retrieves the parent node of a given DOM element. Returns null if the element is a root node. Defined in traversal.ts. ```javascript getParent(elem: AnyNode): null | ParentNode // Parameters: // elem: AnyNode - Node to get the parent of. // Returns null | ParentNode // elem's parent node, or null if elem is a root node. ``` -------------------------------- ### Feed Utilities Source: https://domutils.js.org/types/FeedItemMediaExpression Utilities related to processing and managing feeds and feed items. Includes functions to get feed data and access properties of feed items. ```javascript Feed FeedItem FeedItemMedia FeedItemMediaExpression FeedItemMediaMedium getFeed(feedUrl) ``` -------------------------------- ### Get Next Element Sibling (JavaScript) Source: https://domutils.js.org/functions/nextElementSibling Retrieves the next element sibling of a given node. It returns the sibling if it's a tag element, otherwise null. ```javascript /** * @param {AnyNode} elem The element to get the next sibling of. * @returns {null | Element} `elem`'s next sibling that is a tag, or `null` if there is no next sibling. */ nextElementSibling(elem) ``` -------------------------------- ### DOM Querying Utilities - domutils.js Source: https://domutils.js.org/functions/textContent Offers a variety of functions for querying and filtering DOM elements, including finding elements by various criteria, checking for existence, and filtering collections. ```javascript existsOne(selector: string, context?: AnyNode): boolean filter(nodes: AnyNode[], selector: string): AnyNode[] find(selector: string, context?: AnyNode): AnyNode | null findAll(selector: string, context?: AnyNode): AnyNode[] findOne(selector: string, context?: AnyNode): AnyNode | null findOneChild(node: AnyNode, selector: string): AnyNode | null ``` -------------------------------- ### Legacy DOM Query Functions Source: https://domutils.js.org/modules Includes older functions for querying DOM elements by ID, tag name, class name, and type, along with testing element properties. ```javascript getElementById(id) getElements(selector, context) getElementsByClassName(className, context) getElementsByTagName(tagName, context) getElementsByTagType(tagName, context) testElement(element, options) TestElementOpts ``` -------------------------------- ### Get Element By ID - domutils Source: https://domutils.js.org/functions/getElementById Retrieves a DOM element by its ID. It can search recursively through child nodes. The ID can be a string or a function that validates the ID. ```APIDOC Function getElementById: Parameters: id: string | ((id: string) => boolean) - The unique ID attribute value to look for. nodes: AnyNode | AnyNode[] - Nodes to search through. recurse?: boolean = true - Also consider child nodes. Returns: null | Element - The node with the supplied ID. Defined in legacy.ts:146 ``` -------------------------------- ### DOM Stringify Functions Source: https://domutils.js.org/types/FeedItemMediaExpression Utility functions for converting DOM elements or their content into string representations. This includes getting inner HTML, outer HTML, and text content. ```javascript getInnerHTML(element) getOuterHTML(element) getText(element) innerText(element) textContent(element) ``` -------------------------------- ### Feed Interface Properties Source: https://domutils.js.org/interfaces/Feed Details the properties of the Feed interface, specifying their types and whether they are optional. Includes author, description, id, items, link, title, type, and updated. ```APIDOC author?: string description?: string id?: string items: FeedItem[] link?: string title?: string type: string updated?: Date ``` -------------------------------- ### Legacy Query Functions Source: https://domutils.js.org/functions/compareDocumentPosition Provides legacy functions for querying elements by ID, class name, tag name, and type, along with element testing utilities. ```javascript function getElementById(id: string): HTMLElement | null; function getElements(selector: string): NodeList; function getElementsByClassName(className: string): HTMLCollection; function getElementsByTagName(tagName: string): HTMLCollection; function getElementsByTagType(tagName: string): HTMLCollection; function testElement(element: HTMLElement, options: TestElementOpts): boolean; interface TestElementOpts {} ``` -------------------------------- ### DOM Stringification Utilities Source: https://domutils.js.org/functions/getSiblings Includes functions to get the HTML content of an element, either its inner HTML or outer HTML, as well as methods to extract text content. ```javascript /** * Gets the inner HTML of an element. * @param {AnyNode} elem * @returns {string} */ function getInnerHTML(elem) { // ... } /** * Gets the outer HTML of an element. * @param {AnyNode} elem * @returns {string} */ function getOuterHTML(elem) { // ... } /** * Gets the text content of an element, stripping HTML tags. * @param {AnyNode} elem * @returns {string} */ function getText(elem) { // ... } /** * Gets the innerText property of an element. * @param {AnyNode} elem * @returns {string} */ function innerText(elem) { // ... } /** * Gets the textContent property of an element. * @param {AnyNode} elem * @returns {string} */ function textContent(elem) { // ... } ``` -------------------------------- ### DOM Manipulation Functions Source: https://domutils.js.org/modules Provides functions for appending, prepending, removing, and replacing DOM elements. These functions simplify common DOM manipulation tasks. ```javascript append(element, target) appendChild(element, target) prepend(element, target) prependChild(element, target) removeElement(element) replaceElement(element, newElement) ``` -------------------------------- ### Get Feed from DOM Tree (JavaScript) Source: https://domutils.js.org/functions/getFeed Extracts the feed object from the root of a DOM tree. This function takes an array of AnyNode as input and returns either a Feed object or null. ```javascript getFeed(doc: AnyNode[]): null | Feed // Get the feed object from the root of a DOM tree. // Parameters: // doc: AnyNode[] - The DOM to extract the feed from. // Returns null | Feed - The feed. // Defined in feeds.ts:83 ``` -------------------------------- ### DOM Helper Functions Source: https://domutils.js.org/modules Provides utility functions for comparing DOM element positions and sorting elements, aiding in DOM manipulation and analysis. ```javascript compareDocumentPosition(element1, element2) removeSubsets(elements) uniqueSort(elements) ``` -------------------------------- ### Stringify Utilities - domutils.js Source: https://domutils.js.org/functions/textContent Provides functions for getting the string representation of DOM nodes, including inner HTML, outer HTML, and text content. These are useful for serializing or displaying DOM content. ```javascript getInnerHTML(node: AnyNode): string getOuterHTML(node: AnyNode): string getText(node: AnyNode): string innerText(node: AnyNode): string textContent(node: AnyNode): string ``` -------------------------------- ### DOM Manipulation Utilities - domutils.js Source: https://domutils.js.org/functions/textContent Provides functions for manipulating DOM elements, including appending, prepending, removing, and replacing elements. These utilities simplify common DOM operations. ```javascript append(node: AnyNode, parent: AnyNode): void appendChild(node: AnyNode, parent: AnyNode): void prepend(node: AnyNode, parent: AnyNode): void prependChild(node: AnyNode, parent: AnyNode): void removeElement(node: AnyNode): void replaceElement(node: AnyNode, replacement: AnyNode): void ``` -------------------------------- ### domutils.js: Legacy Query Functions Source: https://domutils.js.org/functions/getChildren Provides legacy functions for querying DOM elements by ID, class name, and tag name. Includes a testElement function with TestElementOpts. ```javascript getElementById getElements getElementsByClassName getElementsByTagName getElementsByTagType testElement TestElementOpts ``` -------------------------------- ### DOM Utilities - Manipulation Functions Source: https://domutils.js.org/functions/getElements Provides functions for manipulating DOM elements, including appending, prepending, removing, and replacing elements. Supports both direct children and general appending/prepending. ```APIDOC append(element: AnyNode, target: AnyNode): void - Appends an element to the end of a target element's children. appendChild(element: AnyNode, parent: AnyNode): void - Appends a child element to a parent element. prepend(element: AnyNode, target: AnyNode): void - Prepends an element to the beginning of a target element's children. prependChild(element: AnyNode, parent: AnyNode): void - Prepends a child element to a parent element. removeElement(element: AnyNode): void - Removes an element from the DOM. replaceElement(newElement: AnyNode, oldElement: AnyNode): void - Replaces an old element with a new element in the DOM. ``` -------------------------------- ### Get Element Siblings Source: https://domutils.js.org/functions/getSiblings Retrieves all siblings of a given DOM element, including the element itself. It prioritizes using the parent's children and falls back to traversing `prev` and `next` pointers if the element is a root node. ```javascript /** * @param {AnyNode} elem Element to get the siblings of. * @returns {AnyNode[]} elem's siblings, including elem. */ function getSiblings(elem) { // Implementation details... } ``` -------------------------------- ### Prepend Element Source: https://domutils.js.org/functions/prepend Prepends a given element before a reference element in the DOM. This function is part of the manipulation utilities. ```javascript /** * Prepend an element before another. * @param {ChildNode} elem The element to prepend before. * @param {ChildNode} prev The element to be added. * @returns {void} */ prepend(elem: ChildNode, prev: ChildNode): void; ``` -------------------------------- ### Get Node Inner Text - domutils.js Source: https://domutils.js.org/functions/getText Retrieves the inner text of a DOM node, similar to `textContent` but handles `
` tags by inserting newlines. It ignores comments and is defined in stringify.ts. Note: This function is deprecated in favor of `textContent`. ```javascript /** * Get a node's inner text. Same as `textContent`, but inserts newlines for `
` tags. Ignores comments. * @param {AnyNode | AnyNode[]} node Node to get the inner text of. * @returns {string} `node`'s inner text. * @deprecated Use `textContent` instead. */ getText(node: AnyNode | AnyNode[]): string; ``` -------------------------------- ### domutils Manipulation Functions Source: https://domutils.js.org/functions/find Functions for manipulating the DOM, including appending, prepending, removing, and replacing elements. ```javascript append(element: AnyNode, parent: ParentNode): void appendChild(element: AnyNode, parent: ParentNode): void prepend(element: AnyNode, parent: ParentNode): void prependChild(element: AnyNode, parent: ParentNode): void removeElement(element: AnyNode): void replaceElement(element: AnyNode, replacement: AnyNode): void ``` -------------------------------- ### Get Node Inner Text (JavaScript) Source: https://domutils.js.org/functions/innerText Retrieves the inner text of a DOM node, specifically ignoring content within `