Bob van Luijt Bob van Luijt - 27 days ago 6x
CSS Question

What is the alternative for Element.createShadowRoot()?

I'm using this piece of code:

function setShadowDOM(i, css){
[], function(hostVal) {
var _root = hostVal.createShadowRoot();
_root.innerHTML = '<style>:host ' + css + '</style><content></content>';

I'm also reading this.

How to solve this? What would be the alternative?


Now you can use attachShadow() instead of createShadowRoot():

The Shadow DOM v1 is a DOM Living Standard.

You can support its implementation for Edge and for Firefox.