Sascha Schulz
2024-09-30 bd8f799af4fd6d61a5cef8b4faa6789fcb5e2b76
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class NameFieldComponent extends HTMLElement {
    constructor() {
        super();
 
        this.root = this.attachShadow({mode: "open"});
 
        this.root.innerHTML = `
            <style>
                span {
                    background-color: coral;
                    color: white;
                }
            </style>
            <span>
                first name: <slot name="first"></slot> |
                last name: <slot name="last"></slot>
            </span>
        `;
    }
}
 
window.customElements.define("name-field", NameFieldComponent);