attachClosedShadow() {
    this.innerHTML = '';
    // 'closed' mode simply makes this.shadowRoot return null. So long as you
    // store the reference somewhere else you can always edit the closed shadow
    this.#closedShadow = this.attachShadow({ mode: 'closed' })
    this.#closedShadow.innerHTML = `
      <style>
        div {
          align-items: center;
          background-color: #FBB;
          display: grid;
          height: 100%;
          justify-items: center;
          width: 100%;
        }
      </style>
      <div>
        <p>Shadow Root Closed</p>
      </div>
    `;
  }
/**
   * Attach a shadowRoot with { mode: 'closed' } to this element, then fill in
   * the markup & styles. The reference to this shadowRoot is kept in a private
   * variable to prevent users / developers from editing it. This is easily
   * circumvented so do not rely on this technique for security
   */
Attach a shadowRoot with { mode: 'closed' } to this element, then fill in
the markup & styles. The reference to this shadowRoot is kept in a private
variable to prevent users / developers from editing it. This is easily
circumvented so do not rely on this technique for security
Attach a shadowRoot with { mode : ' closed ' } to this element then fill in the markup & styles . The reference to this shadowRoot is kept in a private variable to prevent users / developers from editing it . This is easily circumvented so do not rely on this technique for security
attachClosedShadow() {
    this.innerHTML = '';
    this.#closedShadow = this.attachShadow({ mode: 'closed' })
    this.#closedShadow.innerHTML = `
      <style>
        div {
          align-items: center;
          background-color: #FBB;
          display: grid;
          height: 100%;
          justify-items: center;
          width: 100%;
        }
      </style>
      <div>
        <p>Shadow Root Closed</p>
      </div>
    `;
  }
attachClosedShadow ( ) { this . innerHTML = '' ; this . #closedShadow = this . attachShadow ( { mode : 'closed' } ) this . #closedShadow . innerHTML = ` ` ; }
Attach a shadowRoot with { mode: 'closed' } to this element, then fill in
 the markup & styles.
Attach a shadowRoot with { mode : ' closed ' } to this element then fill in the markup & styles .
// 'closed' mode simply makes this.shadowRoot return null. So long as you // store the reference somewhere else you can always edit the closed shadow