UNPKG

1.32 kBTypeScriptView Raw
1import { DOMWindow } from 'jsdom';
2
3/**
4 * The CSSCore module specifies the API (and implements most of the methods)
5 * that should be used when dealing with the display of elements (via their
6 * CSS classes and visibility on screen. It is an API focused on mutating the
7 * display and not reading it as no logical state should be encoded in the
8 * display of elements.
9 */
10declare namespace CSSCore {
11 /**
12 * Adds the class passed in to the element if it doesn't already have it.
13 */
14 function addClass(element: HTMLElement, className: string): HTMLElement;
15 /**
16 * Removes the class passed in from the element
17 */
18 function removeClass(element: HTMLElement, className: string): HTMLElement;
19
20 /**
21 * Helper to add or remove a class from an element based on a condition.
22 */
23 function conditionClass(element: HTMLElement, className: string, condition: boolean): HTMLElement;
24
25 /**
26 * Tests whether the element has the class specified.
27 */
28 function hasClass(element: HTMLElement | DOMWindow, className: string): boolean;
29
30 /**
31 * Tests whether the element matches the selector specified
32 */
33 function matchesSelector(element: HTMLElement | DOMWindow, selector: string): boolean;
34}
35// tslint:disable-next-line export-just-namespace
36export = CSSCore;