vite-plugin-dom
Version:
Enables DOM manipulation and comment injection during the build process
20 lines (19 loc) • 947 B
TypeScript
import { Element } from 'domhandler';
import type { CommentSelectors, Pattern } from './types.js';
/**
* Checks if an element has a given attribute with the provided pattern.
*
* @param elem - The DOM element to check.
* @param attrName - The attribute name to check for.
* @param patterns - The patterns to match against the attribute value.
* It can be a string, a regular expression, or an array of strings or regular expressions.
* @returns `true` if the element has the attribute with the given pattern; otherwise, `false`.
*/
export declare function domHas(elem: Element, attrName: string, patterns: Pattern | Pattern[]): boolean;
/**
* Handles adding comments to elements based on the provided selectors.
*
* @param elem - The DOM element to handle.
* @param selectors - The selectors to match against the element.
*/
export declare function commentsHandler(elem: Element, selectors: CommentSelectors): void;