How to use child elements in Web Components
问题 I am building vanilla web components for educational purposes. Here is my custom checkbox. class Checkbox extends HTMLElement { constructor() { super(); this.shadow = this.attachShadow({mode:'open'}); this.shadow.innerHTML = "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path /></svg><label></label>"; this._checked = false; this.addEventListener("click", this.onClickHandler.bind(this)); } set checked(value) { if(value != this._checked) { this._checked =