UNPKG

5.51 kBTypeScriptView Raw
1export declare function addCssClass(element: HTMLElement, className: string): HTMLElement | undefined;
2export declare function removeCssClass(element: HTMLElement, className: string): void;
3export declare function addOrRemoveCssClass(element: HTMLElement, className: string, addOrRemove: boolean): void;
4/**
5 * This method adds a class to an element and remove that class from all siblings.
6 * Useful for toggling state.
7 * @param {HTMLElement} element The element to receive the class
8 * @param {string} elementClass The class to be assigned to the element
9 * @param {boolean} otherElementClass The class to be assigned to siblings of the element, but not the element itself
10 */
11export declare function radioCssClass(element: HTMLElement, elementClass: string | null, otherElementClass?: string | null): void;
12export declare function containsClass(element: HTMLElement, className: string): boolean;
13export declare function isFocusableFormField(element: HTMLElement): boolean;
14export declare function setDisplayed(element: HTMLElement, displayed: boolean): void;
15export declare function setVisible(element: HTMLElement, visible: boolean): void;
16export declare function setDisabled(element: HTMLElement, disabled: boolean): void;
17export declare function isElementChildOfClass(element: HTMLElement | null, cls: string, maxNest?: number): boolean;
18export declare function getElementSize(el: HTMLElement): {
19 height: number;
20 width: number;
21 paddingTop: number;
22 paddingRight: number;
23 paddingBottom: number;
24 paddingLeft: number;
25 marginTop: number;
26 marginRight: number;
27 marginBottom: number;
28 marginLeft: number;
29 boxSizing: string;
30};
31export declare function getInnerHeight(el: HTMLElement): number;
32export declare function getInnerWidth(el: HTMLElement): number;
33export declare function getAbsoluteHeight(el: HTMLElement): number;
34export declare function getAbsoluteWidth(el: HTMLElement): number;
35export declare function isRtlNegativeScroll(): boolean;
36export declare function getScrollLeft(element: HTMLElement, rtl: boolean): number;
37export declare function setScrollLeft(element: HTMLElement, value: number, rtl: boolean): void;
38export declare function clearElement(el: HTMLElement): void;
39/** @deprecated */
40export declare function removeElement(parent: HTMLElement, cssSelector: string): void;
41export declare function removeFromParent(node: Element | null): void;
42export declare function isVisible(element: HTMLElement): boolean;
43/**
44 * Loads the template and returns it as an element. makes up for no simple way in
45 * the dom api to load html directly, eg we cannot do this: document.createElement(template)
46 * @param {string} template
47 * @returns {HTMLElement}
48 */
49export declare function loadTemplate(template: string): HTMLElement;
50export declare function appendHtml(eContainer: HTMLElement, htmlTemplate: string): void;
51/** @deprecated */
52export declare function getElementAttribute(element: any, attributeName: string): string | null;
53export declare function offsetHeight(element: HTMLElement): number;
54export declare function offsetWidth(element: HTMLElement): number;
55export declare function ensureDomOrder(eContainer: HTMLElement, eChild: HTMLElement, eChildBefore?: HTMLElement | null): void;
56export declare function setDomChildOrder(eContainer: HTMLElement, orderedChildren: (HTMLElement | null)[]): void;
57export declare function insertWithDomOrder(eContainer: HTMLElement, eToInsert: HTMLElement, eChildBefore: HTMLElement | null): void;
58/** @deprecated */
59export declare function prependDC(parent: HTMLElement, documentFragment: DocumentFragment): void;
60export declare function addStylesToElement(eElement: any, styles: any): void;
61export declare function isHorizontalScrollShowing(element: HTMLElement): boolean;
62export declare function isVerticalScrollShowing(element: HTMLElement): boolean;
63export declare function setElementWidth(element: HTMLElement, width: string | number): void;
64export declare function setFixedWidth(element: HTMLElement, width: string | number): void;
65export declare function setElementHeight(element: HTMLElement, height: string | number): void;
66export declare function setFixedHeight(element: HTMLElement, height: string | number): void;
67export declare function formatSize(size: number | string): string;
68/**
69 * Returns true if it is a DOM node
70 * taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
71 * @param {any} o
72 * @return {boolean}
73 */
74export declare function isNode(o: any): boolean;
75/**
76 * Returns true if it is a DOM element
77 * taken from: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
78 * @param {any} o
79 * @returns {boolean}
80 */
81export declare function isElement(o: any): boolean;
82export declare function isNodeOrElement(o: any): boolean;
83/**
84 * Makes a copy of a node list into a list
85 * @param {NodeList} nodeList
86 * @returns {Node[]}
87 */
88export declare function copyNodeList(nodeList: NodeListOf<Node> | null): Node[];
89export declare function iterateNamedNodeMap(map: NamedNodeMap, callback: (key: string, value: string) => void): void;
90/** @deprecated */
91export declare function setCheckboxState(eCheckbox: HTMLInputElement, state: any): void;
92export declare function addOrRemoveAttribute(element: HTMLElement, name: string, value: any): void;
93export declare function nodeListForEach<T extends Node>(nodeList: NodeListOf<T> | null, action: (value: T) => void): void;