moderator-toolbox-nxg-for-reddit / util/ui/dom
util/ui/dom¶
Functions¶
delegate()¶
delegate<
E>(parent,type,selector,handler):void
Defined in: extension/data/util/ui/dom.ts:28
Attaches a delegated event listener to parent that fires handler when
an event of type bubbles up from a descendant matching selector.
The handler receives the original event and the matching descendant element.
Type Parameters¶
E¶
E extends Event = Event
Parameters¶
parent¶
Element | Document
type¶
string
selector¶
string
handler¶
(target, event) => void
Returns¶
void
html()¶
html<
T>(str):T
Defined in: extension/data/util/ui/dom.ts:17
Creates an HTMLElement from an HTML string. The string must have a single
root element. Returns that root element.
Type Parameters¶
T¶
T extends HTMLElement = HTMLElement
Parameters¶
str¶
string
Returns¶
T
onDOMAttach()¶
onDOMAttach(
element,handler):void
Defined in: extension/data/util/ui/dom.ts:72
Runs a callback once the given element is attached to the DOM.
Parameters¶
element¶
HTMLElement
handler¶
() => void
Returns¶
void
qs()¶
qs<
T>(selector,parent?):T|null
Defined in: extension/data/util/ui/dom.ts:4
Shorthand for element.querySelector.
Type Parameters¶
T¶
T extends Element = Element
Parameters¶
selector¶
string
parent?¶
Element | Document
Returns¶
T | null
qsa()¶
qsa<
T>(selector,parent?):T[]
Defined in: extension/data/util/ui/dom.ts:9
Shorthand for element.querySelectorAll, returning a plain array.
Type Parameters¶
T¶
T extends Element = Element
Parameters¶
selector¶
string
parent?¶
Element | Document
Returns¶
T[]
Variables¶
documentInteractive¶
constdocumentInteractive:Promise<void>
Defined in: extension/data/util/ui/dom.ts:54
Resolves once the document reaches at least interactive readiness - the DOM
is parsed, though sub-resources may still be loading.