2019-11-19 03:18:28 +01:00
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
let h1 = null;
|
2020-08-12 00:50:53 +02:00
|
|
|
window.button = null;
|
2019-11-19 03:18:28 +01:00
|
|
|
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>
|