script: Implement Element::GetHTML and ShadowRoot::GetHTML (#36106)

* Serialize html fragments without going through html5ever

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Implement ShadowRoot::GetHtml / Element::GetHtml

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Propagate CanGc annotations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-23 20:04:23 +01:00 committed by GitHub
parent 1c9f486f88
commit 19d5f5f06f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 286 additions and 15941 deletions

View file

@ -120,14 +120,20 @@ partial interface Element {
readonly attribute long clientHeight;
};
// https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface
// https://html.spec.whatwg.org/multipage/#dom-parsing-and-serialization
partial interface Element {
[CEReactions] undefined setHTMLUnsafe(DOMString html);
DOMString getHTML(optional GetHTMLOptions options = {});
[CEReactions, Throws] attribute [LegacyNullToEmptyString] DOMString innerHTML;
[CEReactions, Throws] attribute [LegacyNullToEmptyString] DOMString outerHTML;
};
dictionary GetHTMLOptions {
boolean serializableShadowRoots = false;
sequence<ShadowRoot> shadowRoots = [];
};
// https://fullscreen.spec.whatwg.org/#api
partial interface Element {
Promise<undefined> requestFullscreen();

View file

@ -26,7 +26,7 @@ ShadowRoot includes DocumentOrShadowRoot;
// https://html.spec.whatwg.org/multipage/#dom-parsing-and-serialization
partial interface ShadowRoot {
// [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
// DOMString getHTML(optional GetHTMLOptions options = {});
DOMString getHTML(optional GetHTMLOptions options = {});
// [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerHTML;