@tempots/dom
Version:
Fully-typed frontend framework alternative to React and Angular
26 lines (25 loc) • 1.13 kB
TypeScript
/**
* Creates a setter function for an element attribute based on the attribute's type.
*
* The returned setter function will set the attribute value on the given element
* using the appropriate method (e.g. `setAttribute()`, `setProperty()`) based
* on the attribute's type.
*
* @param attributeName - The name of the attribute to create a setter for.
* @returns A function that sets the attribute value on an element.
* @internal
*/
export declare const _makeSetter: (attributeName: string, element: Element) => (value: unknown) => void;
/**
* Creates a getter function for a specific HTML element attribute.
*
* The returned getter function takes an `Element` and returns the value of the
* specified attribute. The function handles different attribute types (boolean,
* number, date, string) and returns the appropriate type.
*
* @param attributeName - The name of the HTML element attribute to get.
* @returns A function that takes an `Element` and returns the value of the
* specified attribute.
* @internal
*/
export declare const _makeGetter: (attributeName: string, element: Element) => () => any;