File: shadow.html

package info (click to toggle)
python-playwright 1.55.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,728 kB
  • sloc: python: 53,655; javascript: 383; sh: 216; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script>

let h1 = null;
let button = null;
let clicked = false;

window.addEventListener('DOMContentLoaded', () => {
  const shadowRoot = document.body.attachShadow({mode: 'open'});
  h1 = document.createElement('h1');
  h1.textContent = 'Hellow Shadow DOM v1';
  button = document.createElement('button');
  button.textContent = 'Click';
  button.addEventListener('click', () => clicked = true);
  shadowRoot.appendChild(h1);
  shadowRoot.appendChild(button);
});
</script>