diff --git a/component.js b/component.js index f65d5a2..c46a003 100644 --- a/component.js +++ b/component.js @@ -1,17 +1,24 @@ -class MyComponent extends HTMLElement { +class Pet extends HTMLElement { constructor() { super(); const shadow = this.attachShadow({ mode: 'closed' }); const root = document.createElement('section'); + + const name = this.getAttribute('name') + root.innerHTML = ` -

Hello from MyComponent!

+

Pet

+
+
Name
+
${name}
+
`; shadow.appendChild(root) } } -customElements.define('my-component', MyComponent); +customElements.define('pet-component', Pet); diff --git a/index.html b/index.html index c32ad17..397ec0a 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,6 @@ - +