title: Using a non-shadow DOM custom element both inside and outside the shadow DOM
body: <p>I have a custom element (without shadow DOM) that I'd like to be able to use anywhere, even inside another custom element that might use shadow DOM. However, I'm not sure how to get the styles working in both places.</p>
  
  <p>For example, lets say I create a simple <code>fancy-button</code> element:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class fancyButton extends HTMLElement {
    constructor() {
      super();
  
      this.innerHTML = `
        &lt;style&gt;
        fancy-button button {
          padding: 10px 15px;
          background: rgb(62,118,194);
          color: white;
          border: none;
          border-radius: 4px
        }
        &lt;/style&gt;
        &lt;button&gt;Click Me&lt;/button&gt;`;
    }
  }
  
  customElements.define('fancy-button', fancyButton);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;fancy-button&gt;&lt;/fancy-button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Inside a shadow DOM element, the inserted style tag will allow the <code>fancy-button</code> styles to work. However, if this component gets used outside of a shadow DOM element, the style tag will be duplicated every time the element is used.</p>
  
  <p>If instead I add the style tag as part of the html import file, then the styles only work outside of the shadow DOM but at least they are only declared once.</p>
  
  <pre><code>&lt;!-- fancy-button.html --&gt;
  &lt;style&gt;
  fancy-button button {
    padding: 10px 15px;
    background: rgb(62,118,194);
    color: white;
    border: none;
    border-radius: 4px
  }
  &lt;/style&gt;
  
  &lt;script&gt;
  class fancyButton extends HTMLElement {
    constructor() {
      super();
  
      this.innerHTML = `&lt;button&gt;Click Me&lt;/button&gt;`;
    }
  }
  
  customElements.define('fancy-button', fancyButton);
  &lt;/script&gt;
  </code></pre>
  
  <p>What's the best way to add custom element styles that handles both being used inside and outside the shadow DOM?</p>