@ideal-postcodes/jsutil
Version:
Browser Address Autocomplete for api.ideal-postcodes.co.uk
28 lines (27 loc) • 1.73 kB
TypeScript
import { ParentTest, SelectorNode } from "./types";
export declare const hasWindow: () => boolean;
export declare const toArray: <T = HTMLElement>(nodeList: NodeList) => T[];
export declare const loaded: (elem: HTMLElement, prefix?: string) => boolean;
export declare const markLoaded: (elem: HTMLElement, prefix?: string) => void;
export declare const getParent: (node: HTMLElement, entity: string, test?: ParentTest) => HTMLElement | null;
export declare const toHtmlElem: (parent: HTMLElement, selector?: string) => HTMLElement | null;
export declare const getAnchors: (selector: string, d?: Document) => HTMLElement[];
interface InsertBeforeOptions {
elem: HTMLElement;
target: HTMLElement;
}
interface InsertBefore {
(options: InsertBeforeOptions): HTMLElement | undefined;
}
export declare const insertBefore: InsertBefore;
export declare const toElem: (elem: SelectorNode | null, context: HTMLElement | Document) => HTMLElement | null;
export declare const getScope: (scope: null | string | HTMLElement | Document) => HTMLElement | Document;
export declare const getDocument: (scope: HTMLElement | Document) => Document;
export type CSSStyle = Partial<Record<keyof CSSStyleDeclaration, string>>;
export declare const setStyle: (element: HTMLElement, style: CSSStyle) => string | null;
export declare const restoreStyle: (element: HTMLElement, style: string | null) => void;
export declare const hide: <T extends HTMLElement = HTMLElement>(e: T) => T;
export declare const show: <T extends HTMLElement = HTMLElement>(e: T) => T;
export declare const remove: (elem: HTMLElement | null) => void;
export declare const contains: (scope: HTMLElement | Document, selector: string, text: string) => any;
export {};