UNPKG

@mescius/dspdfviewer

Version:
58 lines (57 loc) 2.2 kB
export declare function getShadowRootOrDocument(elem?: HTMLElement): HTMLDocument | ShadowRoot; export declare function closestShadowRootOrBody(element: HTMLElement): HTMLBodyElement | ShadowRoot; /** * Checks if element is nested within parent element on any level. * @param parent * @param child */ export declare function isDescendant(child: Element, parent: Element): boolean; /** * Find correct event target. * @param e */ export declare function getEventTarget(e: any): any; export declare function isInputArea(el: HTMLElement): boolean; /** * Cross-browser element.classList.contains * @param element HTML DOM element * @param className Class name without dot. */ export declare function classListContains(element: HTMLElement, className: string): boolean; /** * Search parent element by class name. * @param el HTML DOM element * @param className Class name without dot. */ export declare function findSelfOrAncestor(el: HTMLElement | null, className: string): HTMLElement | null; /** * Search parent element by attribute name. * @param el HTML DOM element * @param className Attribute name. */ export declare function findSelfOrAncestorAttr(el: HTMLElement | null, attrName: string): HTMLElement | null; /** * Get element's numerical index in its parent element. * @param el HTML DOM element */ export declare function findElementIndex(el: Element): number; export declare function isTouchEventsEnabled(): boolean; export type DomEventCoordinates = { pageX: number; pageY: number; clientX: number; clientY: number; }; export declare function getEventCoordinates(event: MouseEvent | TouchEvent | PointerEvent): DomEventCoordinates; export declare function reversePopupRotation(popupWrapperToRotate: HTMLElement, rotation: number, iconToRotate?: HTMLElement): void; /** * Simulate mouse event. * @param element * @param eventType */ export declare function triggerMouseEvent(element: Element, eventType: string): void; export declare function triggerFullStackClick(element: Element): void; /** * Removes most dangerous tags from html string. **/ export declare function sanitizeHTML(input: any): any;