Bob van Luijt Bob van Luijt - 1 year ago 128
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download