The following code works in chrome allowing declarative shadow dom parsed and inserted with javascript. <script> const html = ` <div> <template shadowrootmode="open"></template> </div> `; const div = document.createElement('div'); div.innerHTML = html; // No shadow root here const fragment = new DOMParser().parseFromString(html, 'text/html', { includeShadowRoots: true }); // Shadow root here </script> However includeShadowRoots parameter is ignored by WebKit For more info: https://developer.chrome.com/articles/declarative-shadow-dom/#parser-only
The plan is to add parseHTMLUnsafe and support declarative shadow DOM there, not add an option to DOMParser.