Created
August 4, 2022 19:16
-
-
Save nolanlawson/94e65587635ad5249525ffec4472a658 to your computer and use it in GitHub Desktop.
Detecting customelements define extends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Via https://github.com/ungap/custom-elements/blob/bdb7c27/index.js#L428-L456 | |
const SUPPORTS_EXTENDING_BUILT_IN_ELEMENTS = (() => { | |
const tagName = `extends-li-${Math.floor(Math.random() * 1000000)}`; | |
self.customElements.define(tagName, class extends HTMLLIElement {}, { extends: 'li' }); | |
const elm = document.createElement('li', { is: tagName }); | |
return elm.outerHTML.indexOf(tagName) !== -1; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment