[w3c/DOM-Parsing] Shadow DOM innerHTML (Issue #73)

There needs to be a way to read the contents of a shadow DOM regardless if it's closed or open when we're not the creator. The function getInnerHTML({includeShadowRoots: true}) works if the shadow root use the template syntax but if a shadow root is generated using a generic implementation like my example below then you can't get the contents of the html of the shadow root. 

An example, 

var _div = document.createElement('div');
var root = _div.attachShadow({mode: 'open'}); // or closed
var helloWorld = document.createElement('div');
helloWorld.innerHTML = '<p>Hello World</p>';

root.appendChild(helloWorld);

I would like to be able to call the element and generate a string by doing element.shadowRoot.innerHTML. This works when we are the creator but it does not work when we're not. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/DOM-Parsing/issues/73
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/DOM-Parsing/issues/73@github.com>

Received on Sunday, 7 August 2022 01:56:49 UTC