lwc
lwc copied to clipboard
[Pivots] Support "extends" key in customElements.define()
Description
With custom element registry pivots (#2564), using the extends
key is not supported:
customElements.define('my-button', Button, { extends: 'button' });
The above code will throw an error:
NotSupportedError: "extends" key in customElements.define() options is not supported
Note: Safari does not support this keyword (WebKit bug).
Tricky parts about supporting this:
- Multiple elements with the same tag name probably can't extend different built-in elements – we only get one chance to call the real
customElements.define()
- The standard pattern is to register
class MyButton extends HTMLButtonElement {}
, and in the polyfill we only patch the globalwindow.HTMLElement
. Do we need to patch all the other ones too? (HTMLButtonElement
,HTMLLIElement
, etc.)
Pivots were dropped in #3310
@rwaldron this is one of those things that we will never support. Probably we should document it somewhere in locker.