Web Components & Shadow DOM

How do you attach a Shadow DOM to a custom element?
class MyElement extends HTMLElement {
  constructor() {
    super();
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        /* Component styles */
      </style>
      <div>Component content</div>
    `;
  }
}
Next Question (4/20)