Skip to content

HtmlElementUtility

Tim Rücker edited this page Dec 8, 2018 · 1 revision

A utility class with some static methods that can be used to interact with HTMLElements.

Class Members

A brief list of all class members with purposes.

public static querySelectByAttribute(selector: string, element: any = document, value: string = null): E | null

calls the querySelector method with the passed selector once with and once without a prefixed data- of the passed element (or document when not passed) and returns the results.

public static querySelectAllByAttribute(selector: string, element: any = document, value: string = null): NodeListOf

See the querySelectByAttribute method. This method does the same, but it uses the querySelectorAll method instead.

public static getSelectorValue(selector: string, element: Element): string

Returns the value of the attribute with the name of the passed selector, which is found at the passed element. The attribute of the element can either be prefix with "data-" or not. It is found in both cases

public static isDescendant(parent: Element, child: Element): boolean

Simply check whether an element is a descendant of another

Clone this wiki locally