2024-02-16 08:14:17 +00:00
|
|
|
<!DOCTYPE html>
|
2017-10-31 19:02:16 +00:00
|
|
|
<script>
|
|
|
|
|
|
|
|
let h1 = null;
|
2020-06-23 05:18:46 +00:00
|
|
|
window.button = null;
|
|
|
|
window.clicked = false;
|
2017-10-31 19:02:16 +00:00
|
|
|
|
|
|
|
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>
|