Optional
target: Element | DocumentFragmentOptional
options: dom.IApplyOptionsimport { apply } from 'deleight/dom/apply';
import { map, range, forEach, zip } from 'deleight/generators';
apply({
main: (main) => {
const newContent = map(range(101, 120), i => `My index is now ${i}`);
const lastChildren = map(main.children, c => c.lastElementChild);
forEach(zip(lastChildren, newContent), ([el, c]) => el.textContent = c);
// set(lastChildren, {textContent: newContent});
}
});
Invoke functions with elements within the input element's tree that match the provided selection criteria. baseApply is used under the hood so the notes about the behavior of that function also apply here.
For this function, the target is an element or document fragment. This function uses get to obtain the 'properties' of the target (by supplying a
getter
option to the underlying function ). This function also pre-fetches the target's property (also using get) before invoking the component functions by using a mapper option.