// Export // ============================================================================= module.exports = function injectTestComponent() { class TestComponent extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.shadowRoot.innerHTML = `

${this.getAttribute('data-text')}

`; } } window.customElements.define('test-component', TestComponent); // createElms({ tag: 'style', text: ':root { --test-component-background: green; }', appendTo: 'head' }); // createElms([ // { tag: 'test-component', attr: { 'data-text': 'Custom element' }}, // { tag: 'p', text: 'Standard element' } // ], { appendTo: 'body' }); };