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

@ -17,6 +17,7 @@ use devtools_traits::AttrInfo;
use dom_struct::dom_struct;
use embedder_traits::InputMethodType;
use euclid::default::{Rect, Size2D};
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever::{
LocalName, Namespace, Prefix, QualName, local_name, namespace_prefix, namespace_url, ns,
@ -67,7 +68,9 @@ use crate::dom::attr::{Attr, AttrHelpersForLayout};
use crate::dom::bindings::cell::{DomRefCell, Ref, RefMut, ref_filter_map};
use crate::dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use crate::dom::bindings::codegen::Bindings::ElementBinding::{ElementMethods, ShadowRootInit};
use crate::dom::bindings::codegen::Bindings::ElementBinding::{
ElementMethods, GetHTMLOptions, ShadowRootInit,
};
use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function;
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
@ -2951,17 +2954,31 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
Node::replace_all(Some(frag.upcast()), &target);
}
/// <https://html.spec.whatwg.org/multipage/#dom-element-gethtml>
fn GetHTML(&self, options: &GetHTMLOptions, can_gc: CanGc) -> DOMString {
// > Element's getHTML(options) method steps are to return the result of HTML fragment serialization
// > algorithm with this, options["serializableShadowRoots"], and options["shadowRoots"].
self.upcast::<Node>().html_serialize(
TraversalScope::ChildrenOnly(None),
options.serializableShadowRoots,
options.shadowRoots.clone(),
can_gc,
)
}
/// <https://html.spec.whatwg.org/multipage/#dom-element-innerhtml>
fn GetInnerHTML(&self) -> Fallible<DOMString> {
fn GetInnerHTML(&self, can_gc: CanGc) -> Fallible<DOMString> {
let qname = QualName::new(
self.prefix().clone(),
self.namespace().clone(),
self.local_name().clone(),
);
// FIXME: This should use the fragment serialization algorithm, which takes
// care of distinguishing between html/xml documents
let result = if self.owner_document().is_html_document() {
self.upcast::<Node>()
.html_serialize(ChildrenOnly(Some(qname)))
.html_serialize(ChildrenOnly(Some(qname)), false, vec![], can_gc)
} else {
self.upcast::<Node>()
.xml_serialize(XmlChildrenOnly(Some(qname)))
@ -3001,9 +3018,12 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
}
/// <https://html.spec.whatwg.org/multipage/#dom-element-outerhtml>
fn GetOuterHTML(&self) -> Fallible<DOMString> {
fn GetOuterHTML(&self, can_gc: CanGc) -> Fallible<DOMString> {
// FIXME: This should use the fragment serialization algorithm, which takes
// care of distinguishing between html/xml documents
let result = if self.owner_document().is_html_document() {
self.upcast::<Node>().html_serialize(IncludeNode)
self.upcast::<Node>()
.html_serialize(IncludeNode, false, vec![], can_gc)
} else {
self.upcast::<Node>().xml_serialize(XmlIncludeNode)
};

View file

@ -21,6 +21,7 @@ use constellation_traits::{
use devtools_traits::NodeInfo;
use dom_struct::dom_struct;
use euclid::default::{Rect, Size2D, Vector2D};
use html5ever::serialize::HtmlSerializer;
use html5ever::{Namespace, Prefix, QualName, namespace_url, ns, serialize as html_serialize};
use js::jsapi::JSObject;
use js::rust::HandleObject;
@ -110,6 +111,7 @@ use crate::dom::nodelist::NodeList;
use crate::dom::processinginstruction::ProcessingInstruction;
use crate::dom::range::WeakRangeVec;
use crate::dom::raredata::NodeRareData;
use crate::dom::servoparser::serialize_html_fragment;
use crate::dom::shadowroot::{IsUserAgentWidget, LayoutShadowRootHelpers, ShadowRoot};
use crate::dom::stylesheetlist::StyleSheetListOwner;
use crate::dom::svgsvgelement::{LayoutSVGSVGElementHelpers, SVGSVGElement};
@ -2862,22 +2864,34 @@ impl Node {
pub(crate) fn html_serialize(
&self,
traversal_scope: html_serialize::TraversalScope,
serialize_shadow_roots: bool,
shadow_roots: Vec<DomRoot<ShadowRoot>>,
can_gc: CanGc,
) -> DOMString {
let mut writer = vec![];
html_serialize::serialize(
let mut serializer = HtmlSerializer::new(
&mut writer,
&self,
html_serialize::SerializeOpts {
traversal_scope,
traversal_scope: traversal_scope.clone(),
..Default::default()
},
);
serialize_html_fragment(
self,
&mut serializer,
traversal_scope,
serialize_shadow_roots,
shadow_roots,
can_gc,
)
.expect("Cannot serialize node");
.expect("Serializing node failed");
// FIXME(ajeffrey): Directly convert UTF8 to DOMString
DOMString::from(String::from_utf8(writer).unwrap())
}
/// <https://w3c.github.io/DOM-Parsing/#dfn-xml-serialization>
pub(crate) fn xml_serialize(
&self,
traversal_scope: xml_serialize::TraversalScope,
@ -2895,14 +2909,23 @@ impl Node {
}
/// <https://html.spec.whatwg.org/multipage/#fragment-serializing-algorithm-steps>
pub(crate) fn fragment_serialization_algorithm(&self, require_well_formed: bool) -> DOMString {
pub(crate) fn fragment_serialization_algorithm(
&self,
require_well_formed: bool,
can_gc: CanGc,
) -> DOMString {
// Step 1. Let context document be node's node document.
let context_document = self.owner_document();
// Step 2. If context document is an HTML document, return the result of HTML fragment serialization algorithm
// with node, false, and « ».
if context_document.is_html_document() {
return self.html_serialize(html_serialize::TraversalScope::ChildrenOnly(None));
return self.html_serialize(
html_serialize::TraversalScope::ChildrenOnly(None),
false,
vec![],
can_gc,
);
}
// Step 3. Return the XML serialization of node given require well-formed.

View file

@ -7,16 +7,19 @@
use std::cell::Cell;
use std::io;
use html5ever::QualName;
use html5ever::buffer_queue::BufferQueue;
use html5ever::serialize::TraversalScope::IncludeNode;
use html5ever::serialize::{AttrRef, Serialize, Serializer, TraversalScope};
use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
use html5ever::tree_builder::{TreeBuilder, TreeBuilderOpts};
use html5ever::{QualName, local_name, namespace_url, ns};
use script_bindings::trace::CustomTraceable;
use servo_url::ServoUrl;
use xml5ever::LocalName;
use crate::dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::ShadowRootMode;
use crate::dom::bindings::codegen::GenericBindings::ShadowRootBinding::ShadowRoot_Binding::ShadowRootMethods;
use crate::dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::characterdata::CharacterData;
@ -29,6 +32,7 @@ use crate::dom::htmltemplateelement::HTMLTemplateElement;
use crate::dom::node::Node;
use crate::dom::processinginstruction::ProcessingInstruction;
use crate::dom::servoparser::{ParsingAlgorithm, Sink};
use crate::dom::shadowroot::ShadowRoot;
use crate::script_runtime::CanGc;
#[derive(JSTraceable, MallocSizeOf)]
@ -121,54 +125,91 @@ fn start_element<S: Serializer>(node: &Element, serializer: &mut S) -> io::Resul
Ok(())
}
fn end_element<S: Serializer>(node: &Element, serializer: &mut S) -> io::Result<()> {
let name = QualName::new(None, node.namespace().clone(), node.local_name().clone());
serializer.end_elem(name)
}
enum SerializationCommand {
OpenElement(DomRoot<Element>),
CloseElement(DomRoot<Element>),
CloseElement(QualName),
SerializeNonelement(DomRoot<Node>),
SerializeShadowRoot(DomRoot<ShadowRoot>),
}
struct SerializationIterator {
stack: Vec<SerializationCommand>,
/// Whether or not shadow roots should be serialized
serialize_shadow_roots: bool,
/// List of shadow root objects that should be serialized
shadow_roots: Vec<DomRoot<ShadowRoot>>,
}
fn rev_children_iter(n: &Node, can_gc: CanGc) -> impl Iterator<Item = DomRoot<Node>> + use<'_> {
if n.downcast::<Element>().is_some_and(|e| e.is_void()) {
return Node::new_document_node().rev_children();
}
match n.downcast::<HTMLTemplateElement>() {
Some(t) => t.Content(can_gc).upcast::<Node>().rev_children(),
None => n.rev_children(),
}
enum SerializationChildrenIterator<C, S> {
None,
Children(C),
ShadowContents(S),
}
impl SerializationIterator {
fn new(node: &Node, skip_first: bool, can_gc: CanGc) -> SerializationIterator {
let mut ret = SerializationIterator { stack: vec![] };
fn new(
node: &Node,
skip_first: bool,
serialize_shadow_roots: bool,
shadow_roots: Vec<DomRoot<ShadowRoot>>,
can_gc: CanGc,
) -> SerializationIterator {
let mut ret = SerializationIterator {
stack: vec![],
serialize_shadow_roots,
shadow_roots,
};
if skip_first || node.is::<DocumentFragment>() || node.is::<Document>() {
for c in rev_children_iter(node, can_gc) {
ret.push_node(&c);
}
ret.handle_node_contents(node, can_gc);
} else {
ret.push_node(node);
}
ret
}
fn push_node(&mut self, n: &Node) {
match n.downcast::<Element>() {
Some(e) => self
.stack
.push(SerializationCommand::OpenElement(DomRoot::from_ref(e))),
None => self.stack.push(SerializationCommand::SerializeNonelement(
DomRoot::from_ref(n),
)),
fn handle_node_contents(&mut self, node: &Node, can_gc: CanGc) {
if node.downcast::<Element>().is_some_and(Element::is_void) {
return;
}
if let Some(template_element) = node.downcast::<HTMLTemplateElement>() {
for child in template_element
.Content(can_gc)
.upcast::<Node>()
.rev_children()
{
self.push_node(&child);
}
} else {
for child in node.rev_children() {
self.push_node(&child);
}
}
if let Some(shadow_root) = node.downcast::<Element>().and_then(Element::shadow_root) {
let should_be_serialized = (self.serialize_shadow_roots && shadow_root.Serializable()) ||
self.shadow_roots.contains(&shadow_root);
if !shadow_root.is_user_agent_widget() && should_be_serialized {
self.stack
.push(SerializationCommand::SerializeShadowRoot(shadow_root));
}
}
}
fn push_node(&mut self, node: &Node) {
let Some(element) = node.downcast::<Element>() else {
self.stack.push(SerializationCommand::SerializeNonelement(
DomRoot::from_ref(node),
));
return;
};
self.stack
.push(SerializationCommand::OpenElement(DomRoot::from_ref(
element,
)));
}
}
@ -176,40 +217,59 @@ impl Iterator for SerializationIterator {
type Item = SerializationCommand;
fn next(&mut self) -> Option<SerializationCommand> {
let res = self.stack.pop();
let res = self.stack.pop()?;
if let Some(SerializationCommand::OpenElement(ref e)) = res {
match &res {
SerializationCommand::OpenElement(element) => {
let name = QualName::new(
None,
element.namespace().clone(),
element.local_name().clone(),
);
self.stack.push(SerializationCommand::CloseElement(name));
self.handle_node_contents(element.upcast(), CanGc::note());
},
SerializationCommand::SerializeShadowRoot(shadow_root) => {
self.stack
.push(SerializationCommand::CloseElement(e.clone()));
for c in rev_children_iter(e.upcast::<Node>(), CanGc::note()) {
self.push_node(&c);
}
.push(SerializationCommand::CloseElement(QualName::new(
None,
ns!(),
local_name!("template"),
)));
self.handle_node_contents(shadow_root.upcast(), CanGc::note());
},
_ => {},
}
res
Some(res)
}
}
impl Serialize for &Node {
fn serialize<S: Serializer>(
&self,
/// <https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm>
pub(crate) fn serialize_html_fragment<S: Serializer>(
node: &Node,
serializer: &mut S,
traversal_scope: TraversalScope,
) -> io::Result<()> {
let node = *self;
let iter = SerializationIterator::new(node, traversal_scope != IncludeNode, CanGc::note());
serialize_shadow_roots: bool,
shadow_roots: Vec<DomRoot<ShadowRoot>>,
can_gc: CanGc,
) -> io::Result<()> {
let iter = SerializationIterator::new(
node,
traversal_scope != IncludeNode,
serialize_shadow_roots,
shadow_roots,
can_gc,
);
for cmd in iter {
match cmd {
SerializationCommand::OpenElement(n) => {
start_element(&n, serializer)?;
},
SerializationCommand::CloseElement(n) => {
end_element(&n, serializer)?;
SerializationCommand::CloseElement(name) => {
serializer.end_elem(name)?;
},
SerializationCommand::SerializeNonelement(n) => match n.type_id() {
NodeTypeId::DocumentType => {
let doctype = n.downcast::<DocumentType>().unwrap();
@ -238,9 +298,58 @@ impl Serialize for &Node {
NodeTypeId::Element(_) => panic!("Element shouldn't appear here"),
NodeTypeId::Attr => panic!("Attr shouldn't appear here"),
},
SerializationCommand::SerializeShadowRoot(shadow_root) => {
// Shadow roots are serialized as template elements with a fixed set of
// attributes. Because these template elements don't actually exist in the DOM
// we have to make up a vector of attributes ourselves.
let mut attributes = vec![];
let mut push_attribute = |name, value| {
let qualified_name = QualName::new(None, ns!(), LocalName::from(name));
attributes.push((qualified_name, value))
};
let mode = if shadow_root.Mode() == ShadowRootMode::Open {
"open"
} else {
"closed"
};
push_attribute("shadowrootmode", mode);
if shadow_root.DelegatesFocus() {
push_attribute("shadowrootdelegatesfocus", "");
}
if shadow_root.Serializable() {
push_attribute("shadowrootserializable", "");
}
if shadow_root.Clonable() {
push_attribute("shadowrootclonable", "");
}
let name = QualName::new(None, ns!(), local_name!("template"));
serializer.start_elem(name, attributes.iter().map(|(a, b)| (a, *b)))?;
},
}
}
Ok(())
}
// TODO: This trait confuses the concepts of XML serialization and HTML serialization and
// the impl should go away eventually
impl Serialize for &Node {
fn serialize<S>(&self, serializer: &mut S, traversal_scope: TraversalScope) -> io::Result<()>
where
S: Serializer,
{
serialize_html_fragment(
self,
serializer,
traversal_scope,
false,
vec![],
CanGc::note(),
)
}
}

View file

@ -81,6 +81,8 @@ mod html;
mod prefetch;
mod xml;
pub(crate) use html::serialize_html_fragment;
#[dom_struct]
/// The parser maintains two input streams: one for input from script through
/// document.write(), and one for input from network.

View file

@ -7,6 +7,7 @@ use std::collections::HashMap;
use std::collections::hash_map::Entry;
use dom_struct::dom_struct;
use html5ever::serialize::TraversalScope;
use servo_arc::Arc;
use style::author_styles::AuthorStyles;
use style::dom::TElement;
@ -17,6 +18,7 @@ use stylo_atoms::Atom;
use crate::conversions::Convert;
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::ElementBinding::GetHTMLOptions;
use crate::dom::bindings::codegen::Bindings::HTMLSlotElementBinding::HTMLSlotElement_Binding::HTMLSlotElementMethods;
use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::ShadowRoot_Binding::ShadowRootMethods;
use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::{
@ -405,11 +407,24 @@ impl ShadowRootMethods<crate::DomTypeHolder> for ShadowRoot {
})
}
/// <https://html.spec.whatwg.org/multipage/#dom-shadowroot-gethtml>
fn GetHTML(&self, options: &GetHTMLOptions, can_gc: CanGc) -> DOMString {
// > ShadowRoot's getHTML(options) method steps are to return the result of HTML fragment serialization
// > algorithm with this, options["serializableShadowRoots"], and options["shadowRoots"].
self.upcast::<Node>().html_serialize(
TraversalScope::ChildrenOnly(None),
options.serializableShadowRoots,
options.shadowRoots.clone(),
can_gc,
)
}
/// <https://html.spec.whatwg.org/multipage/#dom-shadowroot-innerhtml>
fn InnerHTML(&self) -> DOMString {
fn InnerHTML(&self, can_gc: CanGc) -> DOMString {
// ShadowRoot's innerHTML getter steps are to return the result of running fragment serializing
// algorithm steps with this and true.
self.upcast::<Node>().fragment_serialization_algorithm(true)
self.upcast::<Node>()
.fragment_serialization_algorithm(true, can_gc)
}
/// <https://html.spec.whatwg.org/multipage/#dom-shadowroot-innerhtml>

View file

@ -804,7 +804,7 @@ pub(crate) fn handle_get_page_source(
.find_document(pipeline)
.ok_or(ErrorStatus::UnknownError)
.and_then(|document| match document.GetDocumentElement() {
Some(element) => match element.GetOuterHTML() {
Some(element) => match element.GetOuterHTML(can_gc) {
Ok(source) => Ok(source.to_string()),
Err(_) => {
match XMLSerializer::new(document.window(), None, can_gc)

View file

@ -190,7 +190,7 @@ DOMInterfaces = {
},
'Element': {
'canGc': ['SetHTMLUnsafe', 'SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', 'SetId','SetClassName','Prepend','Append','ReplaceChildren','Before','After','ReplaceWith', 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen'],
'canGc': ['SetHTMLUnsafe', 'SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', 'SetId','SetClassName','Prepend','Append','ReplaceChildren','Before','After','ReplaceWith', 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen', 'GetHTML', 'GetInnerHTML', 'GetOuterHTML'],
},
'ElementInternals': {
@ -530,7 +530,7 @@ DOMInterfaces = {
},
'ShadowRoot': {
'canGc': ['ElementFromPoint', 'ElementsFromPoint', 'SetInnerHTML'],
'canGc': ['ElementFromPoint', 'ElementsFromPoint', 'SetInnerHTML', 'GetHTML', 'InnerHTML'],
},
'StaticRange': {

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;

View file

@ -4613,12 +4613,6 @@
[DOMStringList interface: calling contains(DOMString) on location.ancestorOrigins with too few arguments must throw TypeError]
expected: FAIL
[Element interface: document.createElement("noscript") must inherit property "getHTML(optional GetHTMLOptions)" with the proper type]
expected: FAIL
[Element interface: calling getHTML(optional GetHTMLOptions) on document.createElement("noscript") with too few arguments must throw TypeError]
expected: FAIL
[Element interface: document.createElement("noscript") must inherit property "innerHTML" with the proper type]
expected: FAIL
@ -5918,12 +5912,6 @@
[ShadowRoot interface: operation setHTMLUnsafe((TrustedHTML or DOMString))]
expected: FAIL
[ShadowRoot interface: operation getHTML(optional GetHTMLOptions)]
expected: FAIL
[Element interface: operation getHTML(optional GetHTMLOptions)]
expected: FAIL
[OffscreenCanvasRenderingContext2D interface: operation getContextAttributes()]
expected: FAIL
@ -5966,12 +5954,6 @@
[OffscreenCanvasRenderingContext2D interface: attribute lang]
expected: FAIL
[Element interface: document.createElement("div") must inherit property "getHTML(optional GetHTMLOptions)" with the proper type]
expected: FAIL
[Element interface: calling getHTML(optional GetHTMLOptions) on document.createElement("div") with too few arguments must throw TypeError]
expected: FAIL
[Element interface: document.createElement("div") must inherit property "innerHTML" with the proper type]
expected: FAIL

View file

@ -1,2 +1,6 @@
[gethtml-ordering.html]
expected: ERROR
[template position]
expected: FAIL
[both template and attribute position]
expected: FAIL

File diff suppressed because it is too large Load diff