Re: [whatwg/dom] Allow attachShadow on <script> and <style> (Issue #1064)

Yet another winning case for built-in extends:

```js
customElements.define(
  'js-highlighted',
  class extends HTMLScriptElement {
    connectedCallback() { console.log('There you go!'); }
  },
  {extends: 'script'}
);

// try it
document.head.innerHTML = '<script is="js-highlighted"></script>';
```

Works already with all browsers but WebKit based, but there's a ~2K polyfill you can use through feature detections for that in case you target those too (see ungap custom-elements).

Hope this helps 👋

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1064#issuecomment-1059944281

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1064/1059944281@github.com>

Received on Sunday, 6 March 2022 11:26:02 UTC