1. simple payload

payload is ignored as in DCE definition there is no default slot

        <custom-element tag="dce-link" hidden="">
          <a href="#">link πŸ˜ƒ</a>
        </custom-element>
        <dce-link><i>πŸ‹</i></dce-link>
    
link πŸ˜ƒ

2. payload with slot definition and slot value

slots are filled as in template+shadow root

        <custom-element tag="dce-1-slot" hidden="">
           πŸ‡β€οΈ<slot name="slot1"> πŸ₯¦</slot>
        </custom-element>
        <dce-1-slot><i slot="slot1">πŸ₯•</i></dce-1-slot>
    
πŸ‡β€οΈπŸ₯•

2a. payload with slot definition and slot value

unlike in TEMPLATE, same slot can be used multiple times and within attribute

        <custom-element tag="dce-2-slots" hidden="">
           <slot name="slot2"> πŸ˜ƒ</slot> and again:
           <slot name="slot2"> πŸ˜ƒ</slot>
            <xhtml:input placeholder="πŸ‡β€οΈ{//*[@slot='slot2']}">
        </xhtml:input></custom-element>
        <dce-2-slots><i slot="slot2">πŸ₯•</i></dce-2-slots>
        <dce-2-slots></dce-2-slots>
    
πŸ₯• and again: πŸ₯• πŸ˜ƒ and again: πŸ˜ƒ

2b. named default slot

slot without `name` attribute or with blank value `name=''` use whole payload

        <custom-element tag="dce-3-slot" hidden="">
           #1
            <slot name=""> πŸ˜ƒ</slot>
           and
           <slot> πŸ˜ƒ</slot>
        </custom-element>
        <dce-3-slot><i slot="">πŸ₯•</i></dce-3-slot>
    
#1 πŸ₯• and πŸ₯•

2c. named default slot

slot without `name` attribute or with blank value `name=''` use whole payload

        <custom-element tag="dce-4-slot" hidden="">
           #2
            <slot name=""> πŸ˜ƒ</slot>
           and
           <slot> πŸ˜ƒ</slot>
        </custom-element>
        <dce-4-slot>πŸ₯•</dce-4-slot>
    
#2 πŸ₯• and πŸ₯•

2d. default slot

slot without `name` attribute use whole payload


        <custom-element tag="greet-element" hidden="">
          <slot> Hello </slot> World!
        </custom-element>
        <greet-element></greet-element>
        <greet-element>πŸ‘‹</greet-element>
    
Hello World! πŸ‘‹ World!

3. πŸ’ͺ DCE template

Complex case with slots, attributes, dataset, conditional render


        <custom-element tag="pokemon-tile" hidden="" id="shared-template">
            <template>
                <h3> {title} </h3>           <!-- title is an attribute in instance
                                                  mapped into /*/attributes/title -->
                <if test="//smile">      <!-- data-smile DCE instance attribute,
                                                  mapped into /*/dataset/smile
                                                  used in condition -->
                                             <!-- data-smile DCE instance attribute, used as HTML -->
                    <div>Smile as: {//smile}</div> <!-- /datadom/dataset/smile -->
                </if>
                <!-- image would not be visible in sandbox, see live demo -->
                <img src="https://unpkg.com/pokeapi-sprites@2.0.2/sprites/pokemon/other/dream-world/{pokemon-id}.svg" alt="{title} image">
                                                        <!-- image-src and title are DCE instance attributes,
                                                             mapped into /*/attributes/
                                                             used within output attribute via curly brackets -->

                                                        <!-- `slot name=xxx` replaced with elements with `slot=xxx` attribute -->
                <p><slot name="description"><i>description is not available</i></slot></p>
                <for-each select="//*[@pokemon-id]">
                                                        <!-- loop over payload elements with `pokemon-id` attribute,
                                                            i.e LI elements -->
                    <button>
                        <img height="32" src="https://unpkg.com/pokeapi-sprites@2.0.2/sprites/pokemon/other/dream-world/{@pokemon-id}.svg" alt="{text()}">
                        <br>
                        {text()} <!-- text from LI element in loop -->
                    </button>

                </for-each>
            </template>
        </custom-element>

        <pokemon-tile title="bulbasaur" data-smile="πŸ‘Ό" pokemon-id="1">
            <p slot="description">Bulbasaur is a cute PokΓ©mon born with a large seed firmly affixed to its back;
                the seed grows in size as the PokΓ©mon  does.</p>
            <ul>
                <li pokemon-id="2">ivysaur</li>
                <li pokemon-id="3">venusaur</li>
            </ul>
        </pokemon-tile>

        <pokemon-tile title="ninetales" pokemon-id="38">
                <li pokemon-id="37">vulpix</li>
        </pokemon-tile>
    

bulbasaur

Smile as: πŸ‘Ό
bulbasaur image

Bulbasaur is a cute PokΓ©mon born with a large seed firmly affixed to its back; the seed grows in size as the PokΓ©mon does.

ninetales

ninetales image

description is not available