I attempted to create a custom element in a Chrome extension but customeElements.define
is null
.
customElements.define(\'customElement\
As of now custom element
can be used in chrome extensions UI. In Popup ui, option page ui and in the content script as well But it requires a polyfill which is this.
https://github.com/GoogleChromeLabs/ProjectVisBug - this is the one big custom element in the chrome extension.
You may want to first check this article to fully understand what custom elements do and how to build them. As discussed, in building a custom element, you also need to check if document.registerElement
is available. Otherwise, you can simply load webcomponents.js
to polyfill it.
Here are additional references that you may want to check for additional insights.
webcomponentsjs polyfill
.
Chrome will prevent native registerElement
from being executed within a chrome extension.