WebReflection / hyperHTML-Element

An extensible class to define hyperHTML based Custom Elements.
ISC License
202 stars 25 forks source link

customElements is undefined inside HyperHTMLElement. #30

Closed edmondop closed 6 years ago

edmondop commented 6 years ago

We are running a webpack based javascript applicatio. As we updated to HyperHTML 2.10.3 and HyperHTMLElements 1.8.0 the application has stopped rendering with no apparent error on Google Chrome.

However, opening the same application on Firefox, shows an error in the console:

ReferenceError: customElements is not defined[Learn More]

This occurs inside the HyperHTMLElement base class, at this line:

customElements.define(name, Class);

Is there a dependency which has been factored out? The class doesn't seem to have any customElements nor it seems to be defined in the base class HTMLElement

WebReflection commented 6 years ago

customElements has nothing to do with HyperHTMLElements, and you need a polyfill a part to make it work on Firefox, even with version 1.8.0

A suggested polyfill is https://www.npmjs.com/package/document-register-element

WebReflection commented 6 years ago

For reference: https://codepen.io/WebReflection/pen/qKKrYo?editors=0010

This is a live demo that works in every ES2015 compatible browser.