summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-shadow-dom.html
blob: 3b46eb03c6c41bc616ebcc85bc6d635496e5eeed (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
<!DOCTYPE html>
<title>fieldset and shadow DOM</title>
<link rel=fieldset-foo-ref.html>
<p>There should be a normal fieldset below with the legend "Foo".</p>
<template id="my-fieldset">
  <fieldset><slot name="my-text"></slot></fieldset>
</template>

<my-fieldset>
  <legend slot="my-text">Foo</legend>
</my-fieldset>

<script>
customElements.define('my-fieldset',
  class extends HTMLElement {
    constructor() {
      super();

      const template = document.getElementById('my-fieldset');
      const templateContent = template.content;

      this.attachShadow({mode: 'open'}).appendChild(
        templateContent.cloneNode(true)
      );
    }
  }
);
</script>