blob: 7503c7d4b0e53011c303d27366cd17f6e321ccfc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
customElements.define("custom-element", class extends HTMLElement {
constructor() {
super();
const template = document.getElementById("template");
const shadowRoot = this.attachShadow({mode: "open"})
.appendChild(template.content.cloneNode(true));
}
});
</script>
</head>
<body>
<template id="template">
<div>
<slot name="foo"/>
</div>
<div>
<slot/>
</div>
</template>
<custom-element style="display: block;">
<div>3</div><span slot="foo">1</span><div>4</div><span slot="foo">2</span><div>5</div>
</custom-element>
</body>
</html>
|