swap-template

contributed by yuretz

Sometimes it would be nice to be able to preserve the target element or its children in the DOM tree. This extension allows you to do just that by using HTML fragments wrapped in <template> tags and <slot> elements within them.

<slot>
Represents the original element as is
<slot>...some new content</slot>
Represents the original element with its children replaced with some new content
<slot name="children">
Represents the original element child nodes

The example below demonstrates a simple editable list implemented using this extension features.