UNPKG

@zeix/ui-element

Version:

UIElement - a HTML-first library for reactive Web Components

52 lines (26 loc) 990 B
[**@zeix/ui-element**](../README.md) *** [@zeix/ui-element](../globals.md) / fromDOM # Function: fromDOM() > **fromDOM**\<`T`, `C`, `S`\>(`extractors`, `fallback`): [`Extractor`](../type-aliases/Extractor.md)\<`T`, `C`\> Defined in: [src/core/dom.ts:186](https://github.com/zeixcom/ui-element/blob/1e5ebee179adfc4619d3d0e9d2b864d1e97ba797/src/core/dom.ts#L186) Get a value from elements in the DOM ## Type Parameters ### T `T` *extends* `object` ### C `C` *extends* `HTMLElement` = `HTMLElement` ### S `S` *extends* \{ \[K in string\]: LooseExtractor\<string \| T, ElementFromSelector\<K\>\> \} = \{ \} ## Parameters ### extractors `S` An object of extractor functions for selectors as keys to get a value from ### fallback [`ParserOrFallback`](../type-aliases/ParserOrFallback.md)\<`T`, `C`\> Fallback value or parser function ## Returns [`Extractor`](../type-aliases/Extractor.md)\<`T`, `C`\> Loose extractor function to apply to the host element ## Since 0.14.0