LibWeb: Update innerHTML & co IDL definition to match spec

This stuff has moved from a mixin defined by the DOM Parsing spec, over
to the HTML spec, where they are now defined as partial interfaces for
Element and ShadowRoot.

There's also some new functionality that we don't implement yet, so
patch marks them as FIXME properties.
This commit is contained in:
Andreas Kling 2024-06-25 14:21:21 +02:00 committed by Andreas Kling
commit 0c47b3ff97
Notes: sideshowbarker 2024-07-17 10:05:47 +09:00
4 changed files with 29 additions and 9 deletions

View file

@ -37,6 +37,11 @@ struct ShadowRootInit {
bool serializable = false; bool serializable = false;
}; };
struct GetHTMLOptions {
bool serializable_shadow_roots { false };
Vector<JS::Handle<ShadowRoot>> shadow_roots {};
};
// https://w3c.github.io/csswg-drafts/cssom-view-1/#dictdef-scrollintoviewoptions // https://w3c.github.io/csswg-drafts/cssom-view-1/#dictdef-scrollintoviewoptions
struct ScrollIntoViewOptions : public HTML::ScrollOptions { struct ScrollIntoViewOptions : public HTML::ScrollOptions {
Bindings::ScrollLogicalPosition block { Bindings::ScrollLogicalPosition::Start }; Bindings::ScrollLogicalPosition block { Bindings::ScrollLogicalPosition::Start };

View file

@ -3,7 +3,6 @@
#import <DOM/Attr.idl> #import <DOM/Attr.idl>
#import <DOM/ChildNode.idl> #import <DOM/ChildNode.idl>
#import <DOM/DOMTokenList.idl> #import <DOM/DOMTokenList.idl>
#import <DOM/InnerHTML.idl>
#import <DOM/NamedNodeMap.idl> #import <DOM/NamedNodeMap.idl>
#import <DOM/Node.idl> #import <DOM/Node.idl>
#import <DOM/NodeList.idl> #import <DOM/NodeList.idl>
@ -94,12 +93,26 @@ interface Element : Node {
readonly attribute long clientHeight; readonly attribute long clientHeight;
readonly attribute double currentCSSZoom; readonly attribute double currentCSSZoom;
// https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface // https://html.spec.whatwg.org/#dom-parsing-and-serialization
[FIXME, CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
[FIXME] DOMString getHTML(optional GetHTMLOptions options = {});
// FIXME: [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
[CEReactions, LegacyNullToEmptyString] attribute DOMString innerHTML;
// FIXME: [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) outerHTML;
[CEReactions, LegacyNullToEmptyString] attribute DOMString outerHTML; [CEReactions, LegacyNullToEmptyString] attribute DOMString outerHTML;
// FIXME: [CEReactions] undefined insertAdjacentHTML(DOMString position, (TrustedHTML or DOMString) string);
[CEReactions] undefined insertAdjacentHTML(DOMString position, DOMString text); [CEReactions] undefined insertAdjacentHTML(DOMString position, DOMString text);
}; };
dictionary GetHTMLOptions {
boolean serializableShadowRoots = false;
sequence<ShadowRoot> shadowRoots = [];
};
dictionary ShadowRootInit { dictionary ShadowRootInit {
required ShadowRootMode mode; required ShadowRootMode mode;
boolean delegatesFocus = false; boolean delegatesFocus = false;
@ -110,7 +123,6 @@ dictionary ShadowRootInit {
Element includes ParentNode; Element includes ParentNode;
Element includes ChildNode; Element includes ChildNode;
Element includes InnerHTML;
// https://www.w3.org/TR/wai-aria-1.2/#idl_element // https://www.w3.org/TR/wai-aria-1.2/#idl_element
Element includes ARIAMixin; Element includes ARIAMixin;
Element includes Slottable; Element includes Slottable;

View file

@ -1,4 +0,0 @@
// https://w3c.github.io/DOM-Parsing/#the-innerhtml-mixin
interface mixin InnerHTML {
[LegacyNullToEmptyString, CEReactions] attribute DOMString innerHTML;
};

View file

@ -1,6 +1,6 @@
#import <DOM/DocumentFragment.idl> #import <DOM/DocumentFragment.idl>
#import <DOM/DocumentOrShadowRoot.idl> #import <DOM/DocumentOrShadowRoot.idl>
#import <DOM/InnerHTML.idl> #import <DOM/Element.idl>
// https://dom.spec.whatwg.org/#shadowroot // https://dom.spec.whatwg.org/#shadowroot
[Exposed=Window] [Exposed=Window]
@ -12,9 +12,16 @@ interface ShadowRoot : DocumentFragment {
readonly attribute boolean serializable; readonly attribute boolean serializable;
readonly attribute Element host; readonly attribute Element host;
attribute EventHandler onslotchange; attribute EventHandler onslotchange;
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
[FIXME, CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
[FIXME] DOMString getHTML(optional GetHTMLOptions options = {});
// FIXME: [CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
[CEReactions, LegacyNullToEmptyString] attribute DOMString innerHTML;
}; };
ShadowRoot includes InnerHTML;
ShadowRoot includes DocumentOrShadowRoot; ShadowRoot includes DocumentOrShadowRoot;
enum ShadowRootMode { "open", "closed" }; enum ShadowRootMode { "open", "closed" };