WebReflection / hyperHTML

A Fast & Light Virtual DOM Alternative
ISC License
3.07k stars 112 forks source link

How to move childnodes of custom elements? Like slot's #310

Closed AndyOGo closed 5 years ago

AndyOGo commented 5 years ago

I'm curious if <slot>'s or similar functionality to React/JSX children is supported?

Like this example of <custom-element>, which has:

The following children (light DOM):

<custom-element>
  <span>This is some light DOM for custom-element</span>
</custom-element>

need to be properly slotted/injected into it's local DOM like:

<div>
  ${children} <!-- light DOM injection point -->
</div>`;

producing the following flatted DOM:

<custom-element>
  <div>
    <span>This is some light DOM for custom-element</span> <!-- light DOM injection point -->
  </div>
</custom-element>
WebReflection commented 5 years ago

slots are usually handled by custom elements and Shadow DOM, nothing different in hyperHTML, right?

AndyOGo commented 5 years ago

Indeed, if the browser supports it though.

I'm more curious about children in general, if they work and if they get properly diffed incrementally?