diff --git a/component.js b/component.js new file mode 100644 index 0000000..f65d5a2 --- /dev/null +++ b/component.js @@ -0,0 +1,17 @@ +class MyComponent extends HTMLElement { + constructor() { + super(); + + const shadow = this.attachShadow({ mode: 'closed' }); + + const root = document.createElement('section'); + root.innerHTML = ` +

Hello from MyComponent!

+ `; + + shadow.appendChild(root) + } +} + +customElements.define('my-component', MyComponent); + diff --git a/index.html b/index.html new file mode 100644 index 0000000..c32ad17 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + + + + + + + +