document.write("
| <hello-world data-text="&mvte:text;"></hello-world> |
| <mvt:item name="head" param="js:flex_helloworld" /> |
| |
| <template id="hello-world"> |
| <mvt:item name="head" param="css:flex_helloworld" /> |
| <span class="hello-world-text"></span> |
| </template> |
| |
| |
| class HelloWorld extends HTMLElement { |
| constructor() |
| { |
| super(); |
| this.attachShadow( { mode: 'open' } ); |
| } |
| |
| connectedCallback() { |
| const template = document.getElementById( 'hello-world' ); |
| this.shadowRoot.appendChild( template.content.cloneNode( true ) ); |
| |
| this.shadowRoot.querySelector('.hello-world-text').textContent = this.getAttribute( 'data-text' ); |
| } |
| } |
| |
| customElements.define( 'hello-world', HelloWorld ); |
| |
| |
| |
| .hello-world-text |
| { |
| color: red; |
| font-size: 32px; |
| } |
");