The simplest webcomponent

admin

javascript

#вебкомпоненты:
другие самплы
main
index.html
customElements.define('my-paragraph',
    class extends HTMLElement {
        constructor() {
            super();
            let template = document.getElementById('my-paragraph');
            let templateContent = template.content;

            const shadowRoot = this.attachShadow({ mode: 'open' })
                .appendChild(templateContent.cloneNode(true));
        }
    }
);
Новый листинг
скачать через терминал: wget https://coding-style.ru/code_reviews/download/56 && mkdir "the simplest webcomponent" && unzip 56 -d ./"the simplest webcomponent" && rm 56 && cd "the simplest webcomponent"" && git init
(ваш голос учтен)

Прикрепить файл