slotted-element with template demo
git |
slotted-element demo
slotted-element is web component implementing slots without shadow DOM. There are 3 ways of template use:
inline HTML with slots 🎉
Not triggered as "src" attribute is not set.
template HTML with slots 🥳
Slots are hidden in template when "hidden" attribute is set.
Could be shown by slotsAdd() method.
slot1 is visible, hide by setting "hidden" attribute
template by ID, inline HTML redefines slots 🥳
slot0 in template would be overridden.
slot1 is defined in template.
slot0 is overridden in body!
slot0 is overridden in body!
slot0 is overridden in body!