Optional
target: Element | DocumentFragmentOptional
options: dom.IApplyOptionsimport { applyAll } from 'deleight/dom/apply';
import { map, range, forEach, zip } from 'deleight/generators';
apply({
applyAll: ([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});
}
});
Similar to apply but uses selectAll (instead of the default selectFirst) to match elements.