[whatwg/dom] Expose document fragment serialization algorithm (#965)

This came up during TAG review of [Sanitizer API](https://github.com/w3ctag/design-reviews/issues/619).

They have a `sanitize()` method that returns a `DocumentFragment` and a `sanitizeToString()` which [merely calls `sanitize()` and then serializes the fragment](https://wicg.github.io/sanitizer-api/#algorithms). 

Instead of adding ad hoc methods in various Web Platform APIs to invoke the [HTML fragment serialization algorithm](https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm), there should be a way to serialize document fragments directly. I imagine there are reasons not to add `innerHTML` to document fragments, otherwise it would already be there. Perhaps a new getter, or a method that also accepts an optional context type?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/965

Received on Thursday, 1 April 2021 18:23:49 UTC