import { HtmlTools } from '../index.js';
/**
* Properties and attributes of a given DOM element.
*/
export interface ElementData {
[key: string]: unknown;
tagName?: string;
id?: string;
classes?: string[];
data?: Record;
content?: string;
}
/**
* Flags and settings for extraction of data from HTML elements.
*/
export interface ElementDataOptions {
/**
* Add the name of the element's HTML tag to the returned data.
*
* @defaultValue `false`
*/
saveTag?: boolean;
/**
* Convert the 'class' attribute into a 'classes' array.
*
* @defaultValue `true`
*/
splitClasses?: boolean;
/**
* Treat the element's internal HTML as a `content` pseudo-attribute.
*
* @defaultValue `false`
*/
saveHtml?: boolean;
/**
* Group `data-` attributes into a dictionary for easier traversal
*
* @defaultValue `true`
*/
parseData?: boolean;
/**
* Ignore empty attribute values, even ones like `disabled`.
*
* @defaultValue `true`
*/
dropEmptyAttributes?: boolean;
}
/**
* Given a Cheerio object, return a dictionary of HTML attributes for the
* first element.
*
* @remarks
* The 'raw' attributes of the element are modified to make downstream
* processing simpler. In particular:
*
* - The 'class' attribute is changed to an array named 'classes', and any
* whitespace surrounding individual classnames is stripped.
* - 'data-' attributes are moved to a dictionary in the 'data' property.
*
* @param input - An HTML fragment or a Cheerio node, usually the result of a query run on a larger document
* @param options - An {ElementDataOptions} object with flags and settings to control formatting of the returned data.
*/
export declare function findElementData(input: cheerio.Cheerio | string, customOptions?: ElementDataOptions): HtmlTools.ElementData;
//# sourceMappingURL=find-element-data.d.ts.map