import { CreateFunction } from './interfaces'; /** * Adds one or more CSS class names to an HTMLElement, without duplication. * * @param element The Element to which to add CSS classes * @param classes One or more CSS class strings to add to the Element * * @example * dom.addClass(document.body, 'loaded'); * * @example * dom.addClass(document.body, 'loaded', 'ready'); */ export declare function addClass(element: HTMLElement, ...classes: string[]): void; /** * Applies CSS classes to the root element if the specified has features have truthy values. * * @param features One or more features to test and potentially apply CSS classes based on */ export declare function applyFeatureClass(...features: string[]): void; /** * Retrieves an element from the document by its ID attribute. * * @param id ID to match in the DOM * @return the element with a matching ID attribute if found, otherwise null * * @example * let element = dom.byId('anElement'); */ export declare function byId(id: string): HTMLElement | null; /** * Indicates whether the given parent contains the given node. * @param parent The parent node to check within * @param node The node to test whether parent is its ancestor * @return `true` if parent contains node, `false` otherwise */ export declare function contains(parent: Element, node: Node): boolean; export declare let create: CreateFunction; /** * Determines whether an HTMLElement has a given CSS class name. * * @param element The Element to check for a CSS class * @param className The CSS class name to check for * * @example * let hasLoaded = dom.containsClass(document.body, 'loaded'); */ export declare function containsClass(element: HTMLElement, className: string): boolean | void; /** * Creates a DocumentFragment from a string. * * @param html string representation of nodes to create * @return DocumentFragment containing childNodes based on html string * * @example * let fragment = dom.fromString('
'); * * @example * let fragment = dom.fromString('
'); * * @example * let fragment = dom.fromString(''); */ export declare function fromString(html: string): DocumentFragment; export declare enum Position { After = 0, Before = 1, FirstIn = 2, LastIn = 3, Replace = 4, } /** * Places a node in the DOM relative to another node. * * @param node The node to place in the DOM * @param position The position to place the node, relative to relativeElement * @param relativeElement The node to use as a reference when placing * * @example * dom.place(node, dom.Position.After, anotherNode); */ export declare function place(node: Node, position: Position, relativeElement: Element): void; /** * Removes a node from the DOM. * * @param node The node to remove */ export declare function remove(node: Node): void; /** * Removes all instances of one ore more CSS class names from an HTMLElement. * * @param element The Element from which to remove CSS classes * @param classes An array of string CSS classes to remove from the Element * * @example * dom.removeClass(document.body, 'loading'); * * @example * dom.removeClass(document.body, 'loading', 'pending'); */ export declare function removeClass(element: HTMLElement, ...classes: string[]): void; /** * Toggles the presence of a CSS class name on an HTMLElement. An optional * second parameter can be used to force class addition or removal. * * @param element The Element to add or remove classes to or from * @param className The CSS class name add or remove * @param force Forces either class addition if true or class removal if false * * @example * dom.toggleClass(button, 'active'); * * @example * dom.toggleClass(button, 'active', isActive); */ export declare function toggleClass(element: HTMLElement, className: string, force?: boolean): boolean;