Re: [w3c/webcomponents] [idea] Not having <slot> element get in the way of structure. (#589)

For example, here's another idea, using selectors:

```html
<!-- Light tree -->
<div class='host'>
  <img slot="some-slot" ... />
</div>
```
```html
<!-- Shadow tree -->
<div>
  <div class="image-holder">
  </div>
</div>
```

```js
let root = document.querySelector('.host').attachShadow({mode: 'closed'})
root.innerHTML = `... the shadow tree markup from above ...`
root.defineSlot('some-slot', '.image-holder') // find the first match, similar to querySelector

// alternatively, could take an actual instance:
root.defineSlot('some-slot', root.querySelector('.image-holder'))
```

Get what I mean? It would eliminate from having to use an element that doesn't really behave like an element, `<slot>` is like a weird special element that really isn't one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/589#issuecomment-254648020

Received on Tuesday, 18 October 2016 21:42:39 UTC