A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Slots distribution API

jonathank
2015-06-17

Is it about time the slots proposal was discussed here?

I feel like this is something we need as part of the shadow DOM so it would be great to help nudge it along.

I created a quick shim which could be modified to not use Shadow at all and generate slot functionality now:

Slots ‘shim’

In browsers that support Shadow already the template could be swapped out to use content like:

  <template id="pie-shop-template">
    <b>
      <slot name="shop-name">
      </slot>
    </b>
    <slot>
    </slot>
  </template>

Would turn into:

  <template id="pie-shop-template">
    <b>
      <content select="[slot=shop-name]">
      </content>
    </b>
    <content>
    </content>
  </template>

The other change of the code would need to account for DOM manipulation too (Which doesn’t seem to be covered so well in the proposal).