Skip to content Skip to sidebar Skip to footer

Is There Any Environment That Implements The New Custom Elements Specification?

A new version of the custom elements has been released at some point in the past (not sure when, as I haven't directly used the spec for awhile). Is there any polyfill or environme

Solution 1:

2020 Update: now it runs in Chrome, Opera and Edge (Blink), Firefox (Gecko), and partially on Safari (WebKit).

Otherwise you can use a polyfill from WebReflection for IE11 / Firefox / Chrome.

Presentation of what has changed here.


The Custom Elements v1 Specification is available since Chrome v53. It's a native implementation.

Note: You have to run it with a flag to activate the feature:

> chrome --enable-blink-features=CustomElementsV1

You can add the flag in your shortcut if you want.

PS: I recommend to use the last build (Canary) because the implementation is being updated on a regular basis.


Running Example :

classCEv1extendsHTMLElement 
{
  constructor () 
  {
    super()
    console.log( "created this=", this )            
  }
  
  connectedCallback ()
  {
    this.innerHTML = "Hello V1!"
  }
} 
customElements.define( "test-v1", CEv1 )
<test-v1>Feature not activated</test-v1>

Post a Comment for "Is There Any Environment That Implements The New Custom Elements Specification?"