Bug 262608

Summary: support includeShadowRoots in JSAPI for streaming declarative shadow dom
Product: WebKit Reporter: Onur Gumus <onur>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: annevk, rniwa
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Onur Gumus 2023-10-04 02:19:24 PDT
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
Comment 1 Ryosuke Niwa 2023-10-04 13:52:35 PDT
The plan is to add parseHTMLUnsafe and support declarative shadow DOM there, not add an option to DOMParser.