Bug 262608 - support includeShadowRoots in JSAPI for streaming declarative shadow dom
Summary: support includeShadowRoots in JSAPI for streaming declarative shadow dom
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-04 02:19 PDT by Onur Gumus
Modified: 2023-10-04 13:52 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.