Skip to content

Truly independent web browser

LibWeb: Implement the HTML Sanitizer API

Andreas Kling5a8aee652099
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 840e4ee7db6..c63c3663c2d 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -509,6 +509,7 @@ set(SOURCES
HTML/HTMLIFrameElement.cpp
HTML/HTMLImageElement.cpp
HTML/HTMLInputElement.cpp
+ HTML/HTMLInsertion.cpp
HTML/HTMLLabelElement.cpp
HTML/HTMLLegendElement.cpp
HTML/HTMLLIElement.cpp
@@ -616,6 +617,8 @@ set(SOURCES
HTML/RadioNodeList.cpp
HTML/RemoteNavigable.cpp
HTML/RemoteWindow.cpp
+ HTML/Sanitizer.cpp
+ HTML/SanitizerConfiguration.cpp
HTML/Scripting/Agent.cpp
HTML/Scripting/ClassicScript.cpp
HTML/Scripting/Environments.cpp
@@ -946,6 +949,7 @@ set(SOURCES
TrustedTypes/InjectionSink.cpp
TrustedTypes/RequireTrustedTypesForDirective.cpp
TrustedTypes/TrustedHTML.cpp
+ TrustedTypes/TrustedHTMLParserOptions.cpp
TrustedTypes/TrustedScript.cpp
TrustedTypes/TrustedScriptURL.cpp
TrustedTypes/TrustedTypePolicy.cpp
diff --git a/Libraries/LibWeb/DOM/BindingsGlue.h b/Libraries/LibWeb/DOM/BindingsGlue.h
index 4ae22f8c7f6..5eb8020ad26 100644
--- a/Libraries/LibWeb/DOM/BindingsGlue.h
+++ b/Libraries/LibWeb/DOM/BindingsGlue.h
@@ -9,6 +9,7 @@
#include <LibGC/Forward.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Completion.h>
+#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/DOM/NodeFilter.h>
#include <LibWeb/Export.h>
@@ -34,6 +35,10 @@ class ShadowRoot;
namespace Web::Bindings {
+struct ParseHTMLUnsafeOptions;
+struct SetHTMLOptions;
+struct SetHTMLUnsafeOptions;
+
WEB_API JS::ThrowCompletionOr<DOM::NodeFilter::Result> accept_node(JS::Realm&, DOM::NodeFilter&, DOM::Node&);
WEB_API JS::Value filter(DOM::NodeIterator&);
WEB_API JS::ThrowCompletionOr<GC::Ptr<DOM::Node>> next_node(JS::Realm&, DOM::NodeIterator&);
@@ -66,7 +71,12 @@ WEB_API JS::Value document(JS::Realm&, GC::Ref<DOM::Document>);
WEB_API GC::Ref<CSS::StyleSheetList> style_sheets(DOM::Document&);
WEB_API JS::Value adopted_style_sheets(DOM::Document&);
WEB_API WebIDL::ExceptionOr<void> set_adopted_style_sheets(DOM::Document&, JS::Value);
-WEB_API WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html_unsafe(JS::Realm&, TrustedTypes::TrustedHTMLOrString const&);
+WEB_API WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html_unsafe(JS::Realm&, TrustedTypes::TrustedHTMLOrString const&, Variant<ParseHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html(JS::Object&, Utf16String const&, SetHTMLOptions const&);
+inline WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html(JS::Realm& realm, Utf16String const& html, SetHTMLOptions const& options)
+{
+ return parse_html(realm.global_object(), html, options);
+}
WEB_API WebIDL::ExceptionOr<void> write(DOM::Document&, Vector<TrustedTypes::TrustedHTMLOrString> const&);
WEB_API WebIDL::ExceptionOr<void> writeln(DOM::Document&, Vector<TrustedTypes::TrustedHTMLOrString> const&);
WEB_API GC::Ptr<ViewTransition::ViewTransition> start_view_transition(DOM::Document&, GC::Ptr<WebIDL::CallbackType> update_callback);
@@ -74,9 +84,15 @@ WEB_API JS::Value document_named_item_value(WrapperWorld&, JS::Realm&, DOM::Docu
WEB_API WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> inner_html(DOM::ShadowRoot&);
WEB_API WebIDL::ExceptionOr<void> set_inner_html(DOM::ShadowRoot&, TrustedTypes::TrustedHTMLOrString const&);
-WEB_API WebIDL::ExceptionOr<void> set_html_unsafe(DOM::ShadowRoot&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html);
+WEB_API WebIDL::ExceptionOr<void> set_html_unsafe(DOM::ShadowRoot&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> append_html_unsafe(DOM::ShadowRoot&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> prepend_html_unsafe(DOM::ShadowRoot&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
WEB_API GC::Ref<CSS::StyleSheetList> style_sheets(DOM::ShadowRoot&);
WEB_API JS::Value adopted_style_sheets(DOM::ShadowRoot&);
WEB_API WebIDL::ExceptionOr<void> set_adopted_style_sheets(DOM::ShadowRoot&, JS::Value);
+WEB_API WebIDL::ExceptionOr<void> before_html_unsafe(DOM::Node&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> after_html_unsafe(DOM::Node&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> replace_with_html_unsafe(DOM::Node&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+
}
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 7d798c7abae..d4d7cd02ad5 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -48,6 +48,7 @@
#include <LibWeb/Animations/TimeValue.h>
#include <LibWeb/Bindings/CSS.h>
#include <LibWeb/Bindings/Document.h>
+#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Bindings/WrapperWorld.h>
#include <LibWeb/CSS/Angle.h>
@@ -171,6 +172,7 @@
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
#include <LibWeb/HTML/HTMLLinkElement.h>
#include <LibWeb/HTML/HTMLMediaElement.h>
#include <LibWeb/HTML/HTMLMetaElement.h>
@@ -199,6 +201,7 @@
#include <LibWeb/HTML/PopStateEvent.h>
#include <LibWeb/HTML/RadioButtonGroupRegistry.h>
#include <LibWeb/HTML/RemoteNavigable.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
#include <LibWeb/HTML/Scripting/Agent.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Scripting/Environments.h>
@@ -10801,21 +10804,24 @@ void Document::set_allow_declarative_shadow_roots(HTML::HTMLParser::AllowDeclara
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#parse-html-from-a-string
-void Document::parse_html_from_a_string(Utf16View html)
+void Document::parse_html_from_a_string(Utf16View html, HTML::SanitizerConfiguration const* configuration)
{
// 1. Set document's type to "html".
set_document_type(DOM::Document::Type::HTML);
// OPTIMIZATION: Simple markup builds the document directly, without a parser.
- if (HTML::HTMLParser::try_parse_document_fast(*this, html))
+ // NB: This does not sanitize, so it is never used with a sanitizer configuration.
+ if (!configuration && HTML::HTMLParser::try_parse_document_fast(*this, html))
return;
- // 2. Let parser be a new HTML parser whose allow declarative shadow roots is document's allow declarative shadow roots,
- // associated with document.
+ // 2. Let parser be a new HTML parser whose allow declarative shadow roots is document's allow declarative shadow
+ // roots and parser sanitizer configuration is configuration, associated with document.
// 3. Place html into the input stream for parser. The encoding confidence is irrelevant.
auto scripting_mode = is_scripting_enabled() ? HTML::ParserScriptingMode::Normal : HTML::ParserScriptingMode::Disabled;
auto parser = HTML::HTMLParser::create_for_decoded_string(*this, html, scripting_mode, "UTF-8"_utf16);
parser->set_allow_declarative_shadow_roots(allow_declarative_shadow_roots());
+ if (configuration)
+ parser->set_sanitizer_configuration(*configuration);
// 4. Start parser and let it run until it has consumed all the characters just inserted into the input stream.
parser->run(url());
@@ -12273,37 +12279,75 @@ WebIDL::ExceptionOr<void> set_adopted_style_sheets(DOM::Document& document, JS::
return {};
}
-WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html_unsafe(JS::Realm& realm, TrustedTypes::TrustedHTMLOrString const& html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsehtml
+WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html(JS::Object& global, Utf16String const& html, SetHTMLOptions const& options)
{
- // FIXME: update description once https://github.com/whatwg/html/issues/11778 gets solved
- // 1. Let compliantHTML to the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, html, "Document parseHTMLUnsafe", and "script".
- auto const compliant_html = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ auto& realm = HTML::relevant_realm(global);
+ // AD-HOC: Setting the origin to match that of the associated document matches the behavior of existing browsers.
+ auto* window = HTML::window_from_global_object(realm.global_object());
+ VERIFY(window);
+
+ // 1. Let document be a new Document, whose content type is "text/html" and origin is this's relevant global
+ // object's associated Document's origin.
+ // NOTE: Since document does not have a browsing context, scripting is disabled.
+ auto document = DOM::Document::create_for_fragment_parsing(window->page(), *window);
+ document->set_content_type("text/html"_utf16_fly_string);
+ document->set_origin(window->associated_document().origin());
+
+ // 2. Set document's allow declarative shadow roots to true.
+ document->set_allow_declarative_shadow_roots(HTML::HTMLParser::AllowDeclarativeShadowRoots::Yes);
+
+ // 3. Let sanitizerConfig be the result of getting a sanitizer config from options given options and true.
+ auto sanitizer_config = TRY(HTML::get_a_sanitizer_config_from_options(&options, HTML::SanitizerSafety::Safe));
+
+ // 4. Assert: sanitizerConfig is non-null.
+ // NOTE: The sanitizer member of SetHTMLOptions defaults to "default".
+ VERIFY(sanitizer_config.has_value());
+
+ // 5. Parse HTML from a string given document, html, and sanitizerConfig.
+ [[maybe_unused]] auto wrapper = wrap(host_defined_wrapper_world(realm), realm, GC::Ref { *document });
+ document->parse_html_from_a_string(html.utf16_view(), &*sanitizer_config);
+
+ // 6. Return document.
+ return document;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsehtmlunsafe
+WebIDL::ExceptionOr<GC::Root<DOM::Document>> parse_html_unsafe(JS::Realm& realm, TrustedTypes::TrustedHTMLOrString const& html, Variant<ParseHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with the current global object, html, options, and "Document parseHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::current_global_object(),
html,
- TrustedTypes::InjectionSink::Document_parseHTMLUnsafe,
- "script"_utf16));
+ options,
+ TrustedTypes::InjectionSink::Document_parseHTMLUnsafe));
// AD-HOC: Setting the origin to match that of the associated document matches the behavior of existing browsers.
auto* window = HTML::window_from_global_object(realm.global_object());
VERIFY(window);
- // 2. Let document be a new Document, whose content type is "text/html".
+ // 2. Let document be a new Document, whose content type is "text/html" and origin is this's relevant global
+ // object's associated Document's origin.
+ // NOTE: Since document does not have a browsing context, scripting is disabled.
auto document = DOM::Document::create_for_fragment_parsing(window->page(), *window);
document->set_content_type("text/html"_utf16_fly_string);
// 3. Set document's allow declarative shadow roots to true.
document->set_allow_declarative_shadow_roots(HTML::HTMLParser::AllowDeclarativeShadowRoots::Yes);
- // 4. Parse HTML from a string given document and compliantHTML.
+ // 4. Let sanitizerConfig be the result of getting a sanitizer config from options given compliantOptions and
+ // false.
+ auto sanitizer_config = TRY(HTML::get_a_sanitizer_config_from_options(HTML::to_sanitizer_options(compliant_options), HTML::SanitizerSafety::Unsafe));
+
+ // 5. Parse HTML from a string given document, compliantHTML, and sanitizerConfig.
[[maybe_unused]] auto wrapper = wrap(host_defined_wrapper_world(realm), realm, GC::Ref { *document });
- document->parse_html_from_a_string(compliant_html.utf16_view());
+ document->parse_html_from_a_string(compliant_html.utf16_view(), sanitizer_config.has_value() ? &*sanitizer_config : nullptr);
auto& associated_document = window->associated_document();
document->set_origin(associated_document.origin());
- // 5. Return document.
+ // 6. Return document.
return document;
}
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index d5e1942671c..a25a036f689 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -1503,7 +1503,7 @@ public:
Vector<GC::Root<Range>> find_matching_text(Utf16View, CaseSensitivity);
- void parse_html_from_a_string(Utf16View);
+ void parse_html_from_a_string(Utf16View, HTML::SanitizerConfiguration const* = nullptr);
void set_console_client(GC::Ptr<JS::ConsoleClient> console_client) { m_console_client = console_client; }
GC::Ptr<JS::ConsoleClient> console_client() const { return m_console_client; }
diff --git a/Libraries/LibWeb/DOM/Document.idl b/Libraries/LibWeb/DOM/Document.idl
index 5142504b961..8fe14828314 100644
--- a/Libraries/LibWeb/DOM/Document.idl
+++ b/Libraries/LibWeb/DOM/Document.idl
@@ -59,9 +59,8 @@ dictionary ImportNodeOptions {
// https://html.spec.whatwg.org/multipage/dom.html#document
[LegacyOverrideBuiltIns]
partial interface Document {
- // FIXME: parseHTMLUnsafe is missing the ParseHTMLUnsafeOptions parameter.
- [NeedsCallerRealm, ImplementedInBindings] static Document parseHTMLUnsafe((TrustedHTML or DOMString) html);
- [FIXME] static Document parseHTML(DOMString html, optional SetHTMLOptions options = {});
+ [NeedsCallerRealm, ImplementedInBindings] static Document parseHTMLUnsafe((TrustedHTML or DOMString) html, optional (ParseHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [NeedsCallerRealm, ImplementedInBindings] static Document parseHTML(DOMString html, optional SetHTMLOptions options = {});
// resource metadata management
[PutForwards=href, LegacyUnforgeable] readonly attribute Location? location;
diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp
index a0bfc3058d5..d20e1220d11 100644
--- a/Libraries/LibWeb/DOM/Element.cpp
+++ b/Libraries/LibWeb/DOM/Element.cpp
@@ -28,6 +28,7 @@
#include <LibUnicode/CharacterTypes.h>
#include <LibUnicode/Locale.h>
#include <LibWeb/Bindings/CSS.h>
+#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/Bindings/Window.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Bindings/WrapperWorld.h>
@@ -111,6 +112,7 @@
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
#include <LibWeb/HTML/HTMLLIElement.h>
#include <LibWeb/HTML/HTMLMenuElement.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
@@ -2804,7 +2806,7 @@ WebIDL::ExceptionOr<DOM::Element const*> Element::closest(Utf16View selectors) c
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-innerhtml
-WebIDL::ExceptionOr<void> Element::set_inner_html(Utf16View html)
+WebIDL::ExceptionOr<void> Element::set_inner_html(Utf16View html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target = GC::Ref { *this };
auto* template_element = as_if<HTML::HTMLTemplateElement>(*this);
@@ -2814,10 +2816,10 @@ WebIDL::ExceptionOr<void> Element::set_inner_html(Utf16View html)
// OPTIMIZATION: Markup the fast fragment parser supports needs no fragment. Inserting the parsed nodes directly
// runs their insertion steps once and skips removing them from a fragment no one can observe.
GC::RootVector<GC::Ref<Node>> fast_parsed_nodes;
- if (!template_element && HTML::HTMLParser::try_parse_html_fragment_fast_into_detached_nodes(*this, html, fast_parsed_nodes)) {
+ if (!template_element && !trusted_options && HTML::HTMLParser::try_parse_html_fragment_fast_into_detached_nodes(*this, html, fast_parsed_nodes)) {
replace_all(move(fast_parsed_nodes));
} else {
- auto fragment = TRY(parse_fragment(target, html, HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath::Skip));
+ auto fragment = TRY(parse_fragment(target, html, HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath::Skip, trusted_options));
// 5. Replace all with fragment within target.
target.visit([&](auto node) {
@@ -4147,8 +4149,13 @@ bool Element::is_actually_disabled() const
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#fragment-parsing-algorithm-steps
-WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target, Utf16View markup, HTML::ParserScriptingMode scripting_mode, HTML::FragmentFastPath fast_path)
+WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target, Utf16View markup, HTML::ParserScriptingMode scripting_mode, HTML::FragmentFastPath fast_path, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
+ // NB: When a Trusted Types default policy supplied the options, they determine the sanitizer configuration and
+ // the scripting mode.
+ if (trusted_options)
+ return HTML::fragment_parsing_algorithm_steps(target, markup, GC::Ref { *trusted_options }, HTML::FragmentParserMode::Legacy);
+
// NB: This helper implements Legacy mode with no sanitizer configuration; callers supply scriptingMode.
// The HTML fragment parser requires scriptingMode to be either Inert or Fragment.
VERIFY(scripting_mode == HTML::ParserScriptingMode::Inert || scripting_mode == HTML::ParserScriptingMode::Fragment);
@@ -4171,7 +4178,7 @@ WebIDL::ExceptionOr<Utf16String> Element::outer_html() const
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-outerhtml
-WebIDL::ExceptionOr<void> Element::set_outer_html(StringView html)
+WebIDL::ExceptionOr<void> Element::set_outer_html(StringView html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
// 2. Let parent be this's parent.
GC::Ptr<Node> parent = this->parent();
@@ -4190,7 +4197,7 @@ WebIDL::ExceptionOr<void> Element::set_outer_html(StringView html)
// 6. Let fragment be the result of invoking the fragment parsing algorithm steps given parent and compliantString.
auto markup = Utf16String::from_utf8(html);
- auto fragment = TRY(parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { GC::Ref { as<Element>(*parent) } }, markup.utf16_view()));
+ auto fragment = TRY(parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { GC::Ref { as<Element>(*parent) } }, markup.utf16_view(), HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath::Allow, trusted_options));
// 6. Replace this with fragment within this's parent.
TRY(this->parent()->replace_child(fragment, *this));
@@ -4199,7 +4206,7 @@ WebIDL::ExceptionOr<void> Element::set_outer_html(StringView html)
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#the-insertadjacenthtml()-method
-WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position, StringView html)
+WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position, StringView html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
// 2. Let context be null.
GC::Ptr<Node> context;
@@ -4243,7 +4250,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position,
// 5. Let fragment be the result of invoking the fragment parsing algorithm steps with context and compliantString.
auto markup = Utf16String::from_utf8(html);
- auto fragment = TRY(parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { GC::Ref { as<Element>(*context) } }, markup.utf16_view()));
+ auto fragment = TRY(parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { GC::Ref { as<Element>(*context) } }, markup.utf16_view(), HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath::Allow, trusted_options));
// 6. Use the first matching item from this list:
@@ -6824,19 +6831,35 @@ WebIDL::ExceptionOr<Utf16String> Element::get_html(HTMLSerializationOptions cons
options.shadow_roots);
}
-// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-sethtmlunsafe
-WebIDL::ExceptionOr<void> Element::set_html_unsafe(StringView html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-sethtml
+WebIDL::ExceptionOr<void> Element::set_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
{
- // 2. Let target be this's template contents if this is a template element; otherwise this.
- Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::DocumentFragment>> target = GC::Ref { *this };
- if (is<HTML::HTMLTemplateElement>(*this))
- target = as<HTML::HTMLTemplateElement>(*this).content();
+ // 1. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(*this);
- // 3. Unsafe set HTML given target, this, and compliantHTML.
- auto markup = Utf16String::from_utf8(html);
- TRY(unsafely_set_html(move(target), markup.utf16_view()));
+ // 2. Filter and set HTML given target, html, options, and Safe.
+ return HTML::filter_and_set_html(target, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
- return {};
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-appendhtml
+WebIDL::ExceptionOr<void> Element::append_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // 1. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(*this);
+
+ // 2. Filter and pre-insert HTML given target, null, html, options, and Safe.
+ return HTML::filter_and_pre_insert_html(target, nullptr, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-prependhtml
+WebIDL::ExceptionOr<void> Element::prepend_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // 1. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(*this);
+
+ // 2. Filter and pre-insert HTML given target, target's first child, html, options, and Safe.
+ auto first_child = target.visit([](auto node) { return GC::Ptr<Node> { node->first_child() }; });
+ return HTML::filter_and_pre_insert_html(target, first_child, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
}
// https://html.spec.whatwg.org/multipage/dom.html#advisory-information
@@ -7434,16 +7457,12 @@ WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> inner_html(DOM::Element&
WebIDL::ExceptionOr<void> set_inner_html(DOM::Element& element, TrustedTypes::TrustedHTMLOrString const& value)
{
- // 1. Let compliantString be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, the given value, "Element innerHTML", and "script".
- auto const compliant_string = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
- HTML::relevant_global_object(element),
- value,
- TrustedTypes::InjectionSink::Element_innerHTML,
- "script"sv));
+ // 1. Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input
+ // algorithm with this's relevant global object, the given value, a new SetHTMLUnsafeOptions dictionary,
+ // "Element innerHTML", this's node document's type, and false.
+ auto const [compliant_string, trusted_options] = TRY(HTML::get_trusted_type_compliant_input_for_legacy_sink(element, value, TrustedTypes::InjectionSink::Element_innerHTML));
- return element.set_inner_html(compliant_string);
+ return element.set_inner_html(compliant_string, trusted_options);
}
WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> outer_html(DOM::Element& element)
@@ -7453,44 +7472,77 @@ WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> outer_html(DOM::Element&
WebIDL::ExceptionOr<void> set_outer_html(DOM::Element& element, TrustedTypes::TrustedHTMLOrString const& value)
{
- // 1. Let compliantString be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, the given value, "Element outerHTML", and "script".
- auto const compliant_string = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ // 1. Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input
+ // algorithm with this's relevant global object, the given value, a new SetHTMLUnsafeOptions dictionary,
+ // "Element outerHTML", this's node document's type, and false.
+ auto const [compliant_string, trusted_options] = TRY(HTML::get_trusted_type_compliant_input_for_legacy_sink(element, value, TrustedTypes::InjectionSink::Element_outerHTML));
+
+ return element.set_outer_html(compliant_string.to_utf8_but_should_be_ported_to_utf16(), trusted_options);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-sethtmlunsafe
+WebIDL::ExceptionOr<void> set_html_unsafe(DOM::Element& element, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Element setHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::relevant_global_object(element),
- value,
- TrustedTypes::InjectionSink::Element_outerHTML,
- "script"sv));
+ html,
+ options,
+ TrustedTypes::InjectionSink::Element_setHTMLUnsafe));
- return element.set_outer_html(compliant_string.to_utf8_but_should_be_ported_to_utf16());
+ // 2. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(element);
+
+ // 3. Filter and set HTML given target, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_set_html(target, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
}
-WebIDL::ExceptionOr<void> set_html_unsafe(DOM::Element& element, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-appendhtmlunsafe
+WebIDL::ExceptionOr<void> append_html_unsafe(DOM::Element& element, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
{
- // 1. Let compliantHTML be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, html, "Element setHTMLUnsafe", and "script".
- auto const compliant_html = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Element appendHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::relevant_global_object(element),
html,
- TrustedTypes::InjectionSink::Element_setHTMLUnsafe,
- "script"sv));
+ options,
+ TrustedTypes::InjectionSink::Element_appendHTMLUnsafe));
+
+ // 2. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(element);
- return element.set_html_unsafe(compliant_html.to_utf8_but_should_be_ported_to_utf16());
+ // 3. Filter and pre-insert HTML given target, null, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_pre_insert_html(target, nullptr, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
}
-WebIDL::ExceptionOr<void> insert_adjacent_html(DOM::Element& element, Utf16String const& position, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& text)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-element-prependhtmlunsafe
+WebIDL::ExceptionOr<void> prepend_html_unsafe(DOM::Element& element, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
{
- // 1. Let compliantString be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, string, "Element insertAdjacentHTML", and "script".
- auto const compliant_string = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Element prependHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::relevant_global_object(element),
- text,
- TrustedTypes::InjectionSink::Element_insertAdjacentHTML,
- "script"sv));
+ html,
+ options,
+ TrustedTypes::InjectionSink::Element_prependHTMLUnsafe));
+
+ // 2. Let target be the target for HTML insertion given this.
+ auto target = HTML::target_for_html_insertion(element);
+
+ // 3. Filter and pre-insert HTML given target, target's first child, compliantHTML, compliantOptions, and Unsafe.
+ auto first_child = target.visit([](auto node) { return GC::Ptr<DOM::Node> { node->first_child() }; });
+ return HTML::filter_and_pre_insert_html(target, first_child, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
+}
+
+WebIDL::ExceptionOr<void> insert_adjacent_html(DOM::Element& element, Utf16String const& position, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& text)
+{
+ // 1. Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input
+ // algorithm with this's relevant global object, the given value, a new SetHTMLUnsafeOptions dictionary,
+ // "Element insertAdjacentHTML", this's node document's type, and false.
+ auto const [compliant_string, trusted_options] = TRY(HTML::get_trusted_type_compliant_input_for_legacy_sink(element, text, TrustedTypes::InjectionSink::Element_insertAdjacentHTML));
- return element.insert_adjacent_html(position.to_utf8(), compliant_string.to_utf8_but_should_be_ported_to_utf16());
+ return element.insert_adjacent_html(position.to_utf8(), compliant_string.to_utf8_but_should_be_ported_to_utf16(), trusted_options);
}
WebIDL::ExceptionOr<void> set_attribute(DOM::Element& element, Utf16String const& qualified_name, Variant<GC::Ref<TrustedTypes::TrustedHTML>, GC::Ref<TrustedTypes::TrustedScript>, GC::Ref<TrustedTypes::TrustedScriptURL>, Utf16String> const& value)
diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h
index 4da65e1cfec..b4c7a74cfae 100644
--- a/Libraries/LibWeb/DOM/Element.h
+++ b/Libraries/LibWeb/DOM/Element.h
@@ -71,6 +71,8 @@ enum class ScrollIntoViewContainer : u8;
enum class ScrollLogicalPosition : u8;
struct GetHTMLOptions;
struct PointerLockOptions;
+struct SetHTMLOptions;
+struct SetHTMLUnsafeOptions;
WEB_API void set_prototype_from_custom_element_definition_if_needed(DOM::Element&, JS::HostObject& wrapper);
WEB_API JS::Value element(JS::Realm&, GC::Ref<DOM::Element>);
WEB_API DOM::Element* element_from_value(JS::Value);
@@ -86,7 +88,9 @@ WEB_API WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> inner_html(DOM::E
WEB_API WebIDL::ExceptionOr<void> set_inner_html(DOM::Element&, TrustedTypes::TrustedHTMLOrString const&);
WEB_API WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> outer_html(DOM::Element&);
WEB_API WebIDL::ExceptionOr<void> set_outer_html(DOM::Element&, TrustedTypes::TrustedHTMLOrString const&);
-WEB_API WebIDL::ExceptionOr<void> set_html_unsafe(DOM::Element&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&);
+WEB_API WebIDL::ExceptionOr<void> set_html_unsafe(DOM::Element&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> append_html_unsafe(DOM::Element&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
+WEB_API WebIDL::ExceptionOr<void> prepend_html_unsafe(DOM::Element&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const&);
WEB_API WebIDL::ExceptionOr<void> insert_adjacent_html(DOM::Element&, Utf16String const& position, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&);
WEB_API WebIDL::ExceptionOr<void> set_attribute(DOM::Element&, Utf16String const&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, GC::Ref<TrustedTypes::TrustedScript>, GC::Ref<TrustedTypes::TrustedScriptURL>, Utf16String> const&);
WEB_API WebIDL::ExceptionOr<void> set_attribute_ns(DOM::Element&, Optional<Utf16FlyString> const&, Utf16FlyString const&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, GC::Ref<TrustedTypes::TrustedScript>, GC::Ref<TrustedTypes::TrustedScriptURL>, Utf16String> const&);
@@ -529,18 +533,20 @@ public:
CSS::StyleScope& document_or_shadow_root_style_scope();
ElementByIdMap& document_or_shadow_root_element_by_id_map();
- static WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target, Utf16View markup, HTML::ParserScriptingMode = HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath = HTML::FragmentFastPath::Allow);
+ static WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target, Utf16View markup, HTML::ParserScriptingMode = HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath = HTML::FragmentFastPath::Allow, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
[[nodiscard]] GC::Ptr<Element const> element_to_inherit_style_from(Optional<CSS::PseudoElement>) const;
WebIDL::ExceptionOr<Utf16String> inner_html() const;
- WebIDL::ExceptionOr<void> set_inner_html(Utf16View html);
+ WebIDL::ExceptionOr<void> set_inner_html(Utf16View html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
- WebIDL::ExceptionOr<void> set_html_unsafe(StringView html);
+ WebIDL::ExceptionOr<void> set_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> append_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> prepend_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
WebIDL::ExceptionOr<Utf16String> get_html(HTMLSerializationOptions const&) const;
- WebIDL::ExceptionOr<void> insert_adjacent_html(String const& position, StringView html);
+ WebIDL::ExceptionOr<void> insert_adjacent_html(String const& position, StringView html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
enum class FullscreenRequester {
Bindings,
@@ -572,7 +578,7 @@ public:
bool is_picture_in_picture_element() const;
WebIDL::ExceptionOr<Utf16String> outer_html() const;
- WebIDL::ExceptionOr<void> set_outer_html(StringView html);
+ WebIDL::ExceptionOr<void> set_outer_html(StringView html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
bool is_focused() const;
bool is_the_active_element() const;
diff --git a/Libraries/LibWeb/DOM/Element.idl b/Libraries/LibWeb/DOM/Element.idl
index 9804b5dc034..5029e9a983f 100644
--- a/Libraries/LibWeb/DOM/Element.idl
+++ b/Libraries/LibWeb/DOM/Element.idl
@@ -58,9 +58,12 @@ dictionary ShadowRootInit {
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
partial interface Element {
- [FIXME, CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
- // FIXME: setHTMLUnsafe is missing the SetHTMLUnsafeOptions parameter.
- [CEReactions, ImplementedInBindings] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
+ [CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined appendHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined prependHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions, ImplementedInBindings] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined appendHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined prependHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
DOMString getHTML(optional GetHTMLOptions options = {});
// FIXME: Only the DOMString variant should have the LegacyNullToEmptyString attribute.
diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
index 54b3102c764..8bf0796995c 100644
--- a/Libraries/LibWeb/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -20,6 +20,7 @@
#include <LibJS/Runtime/ExternalMemory.h>
#include <LibWeb/Animations/Animation.h>
#include <LibWeb/Bindings/Node.h>
+#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/CSS/CountersSet.h>
#include <LibWeb/CSS/GeneratedContent.h>
@@ -32,6 +33,7 @@
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/DOM/AccessibilityTreeNode.h>
#include <LibWeb/DOM/Attr.h>
+#include <LibWeb/DOM/BindingsGlue.h>
#include <LibWeb/DOM/CDATASection.h>
#include <LibWeb/DOM/CharacterData.h>
#include <LibWeb/DOM/Comment.h>
@@ -69,6 +71,7 @@
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
#include <LibWeb/HTML/HTMLLegendElement.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
#include <LibWeb/HTML/HTMLOptionElement.h>
@@ -102,6 +105,8 @@
#include <LibWeb/Painting/BoxViews.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGTitleElement.h>
+#include <LibWeb/TrustedTypes/RequireTrustedTypesForDirective.h>
+#include <LibWeb/TrustedTypes/TrustedTypePolicy.h>
#include <LibWeb/VisualLines.h>
#include <LibWeb/XLink/AttributeNames.h>
#include <LibWebCommon/Infra/CharacterTypes.h>
@@ -3544,20 +3549,46 @@ WebIDL::ExceptionOr<Utf16String> Node::serialize_fragment(HTML::RequireWellForme
return HTML::serialize_node_to_xml_string(*this, require_well_formed);
}
-// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#unsafely-set-html
-WebIDL::ExceptionOr<void> Node::unsafely_set_html(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> target, Utf16View html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-beforehtml
+WebIDL::ExceptionOr<void> Node::before_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
{
- // FIXME: Update for sanitizer API.
- // 7. Let fragment be the result of invoking the HTML fragment parsing algorithm given target, html, true, and scriptingMode.
- auto fragment = TRY(HTML::HTMLParser::parse_html_fragment(target, html, HTML::HTMLParser::AllowDeclarativeShadowRoots::Yes));
+ // 1. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(*this));
- // 2. Let fragment be a new DocumentFragment whose node document is contextElement’s node document.
- // The parser already produced the fragment.
+ // 2. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
- // Replace all with fragment within target.
- target.visit([&](auto node) { node->replace_all(fragment); });
+ // 3. Filter and pre-insert HTML given parent, this, html, options, and Safe.
+ return HTML::filter_and_pre_insert_html(*parent, this, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
- return {};
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-afterhtml
+WebIDL::ExceptionOr<void> Node::after_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // 1. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(*this));
+
+ // 2. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
+
+ // 3. Filter and pre-insert HTML given parent, this's next sibling, html, options, and Safe.
+ return HTML::filter_and_pre_insert_html(*parent, next_sibling(), html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-replacewithhtml
+WebIDL::ExceptionOr<void> Node::replace_with_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // 1. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(*this));
+
+ // 2. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
+
+ // 3. Filter and replace with HTML given parent, this, html, options, and Safe.
+ return HTML::filter_and_replace_with_html(*parent, *this, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
}
// https://dom.spec.whatwg.org/#dom-node-issamenode
@@ -4989,3 +5020,73 @@ GC::Ptr<ShadowRoot> Node::containing_shadow_root()
}
}
+
+namespace Web::Bindings {
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-beforehtmlunsafe
+WebIDL::ExceptionOr<void> before_html_unsafe(DOM::Node& node, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Node beforeHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
+ HTML::relevant_global_object(node),
+ html,
+ options,
+ TrustedTypes::InjectionSink::Node_beforeHTMLUnsafe));
+
+ // 2. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(node));
+
+ // 3. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
+
+ // 4. Filter and pre-insert HTML given parent, this, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_pre_insert_html(*parent, node, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-afterhtmlunsafe
+WebIDL::ExceptionOr<void> after_html_unsafe(DOM::Node& node, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Node afterHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
+ HTML::relevant_global_object(node),
+ html,
+ options,
+ TrustedTypes::InjectionSink::Node_afterHTMLUnsafe));
+
+ // 2. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(node));
+
+ // 3. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
+
+ // 4. Filter and pre-insert HTML given parent, this's next sibling, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_pre_insert_html(*parent, node.next_sibling(), compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-nondocumenttypechildnode-replacewithhtmlunsafe
+WebIDL::ExceptionOr<void> replace_with_html_unsafe(DOM::Node& node, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "Node replaceWithHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
+ HTML::relevant_global_object(node),
+ html,
+ options,
+ TrustedTypes::InjectionSink::Node_replaceWithHTMLUnsafe));
+
+ // 2. Let parent be the parent for HTML insertion given this.
+ auto parent = TRY(HTML::parent_for_html_insertion(node));
+
+ // 3. If parent is null, then return.
+ if (!parent.has_value())
+ return {};
+
+ // 4. Filter and replace with HTML given parent, this, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_replace_with_html(*parent, node, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
+}
+
+}
diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h
index 4f9296fe0e5..60506085f71 100644
--- a/Libraries/LibWeb/DOM/Node.h
+++ b/Libraries/LibWeb/DOM/Node.h
@@ -58,6 +58,7 @@ struct FfiBoxMarks;
namespace Web::Bindings {
struct GetRootNodeOptions;
+struct SetHTMLOptions;
}
@@ -562,7 +563,11 @@ public:
WebIDL::ExceptionOr<Utf16String> serialize_fragment(HTML::RequireWellFormed, FragmentSerializationMode = FragmentSerializationMode::Inner) const;
- WebIDL::ExceptionOr<void> unsafely_set_html(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>>, Utf16View);
+ // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
+ // NB: These are the NonDocumentTypeChildNode methods, which are exposed on Element and CharacterData objects.
+ WebIDL::ExceptionOr<void> before_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> after_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> replace_with_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
void replace_all(GC::Ptr<Node>);
void replace_all(GC::RootVector<GC::Ref<Node>>);
diff --git a/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.idl b/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.idl
index 2502b0c363f..6e3ad5bd41e 100644
--- a/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.idl
+++ b/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.idl
@@ -3,3 +3,13 @@ interface mixin NonDocumentTypeChildNode {
readonly attribute Element? previousElementSibling;
readonly attribute Element? nextElementSibling;
};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
+partial interface mixin NonDocumentTypeChildNode {
+ [CEReactions] undefined beforeHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined afterHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined replaceWithHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions, ImplementedInBindings] undefined beforeHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined afterHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined replaceWithHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+};
diff --git a/Libraries/LibWeb/DOM/Range.cpp b/Libraries/LibWeb/DOM/Range.cpp
index eb6ddaba084..25082d2b1ae 100644
--- a/Libraries/LibWeb/DOM/Range.cpp
+++ b/Libraries/LibWeb/DOM/Range.cpp
@@ -27,6 +27,7 @@
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/Geometry/DOMRectList.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
#include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/HTML/Scripting/Environments.h>
@@ -1451,26 +1452,10 @@ Gfx::DoubleRect Range::bounding_client_rect()
return bounding_rect.to_type<float>().to_type<double>();
}
-WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> Range::create_contextual_fragment(TrustedTypes::TrustedHTMLOrString const& string)
-{
- // 1. Let compliantString be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, string, "Range createContextualFragment", and "script".
- auto const compliant_string = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
- HTML::relevant_global_object(*start_container()),
- string,
- TrustedTypes::InjectionSink::Range_createContextualFragment,
- "script"_utf16));
-
- return create_contextual_fragment(compliant_string.to_utf8_but_should_be_ported_to_utf16());
-}
-
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-range-createcontextualfragment
-WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> Range::create_contextual_fragment(StringView string)
+// NB: The steps after node, compliantString and compliantOptions have been determined.
+static WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> create_contextual_fragment_for_node(GC::Ref<Node> node, StringView string, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
- // 2. Let node be this's start node.
- GC::Ref<Node> node = *start_container();
-
// 3. Let element be null.
GC::Ptr<Element> element = nullptr;
@@ -1487,14 +1472,39 @@ WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> Range::create_contextual_fragment
// - element's local name is "html"; and
// - element's namespace is the HTML namespace;
if (!element || is<HTML::HTMLHtmlElement>(*element)) {
- // then set element to the result of creating an element given this's node document,
+ // then set element to the result of creating an element given node's node document,
// "body", and the HTML namespace.
element = TRY(DOM::create_element(node->document(), HTML::TagNames::body, Namespace::HTML));
}
- // 7. Return the result of invoking the fragment parsing algorithm steps with element, compliantString, and Fragment.
+ // 7. Return the result of invoking the fragment parsing algorithm steps given element, compliantString,
+ // compliantOptions, and Legacy.
auto markup = Utf16String::from_utf8(string);
- return Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { *element }, markup.utf16_view(), HTML::ParserScriptingMode::Fragment);
+ return Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { *element }, markup.utf16_view(), HTML::ParserScriptingMode::Fragment, HTML::FragmentFastPath::Allow, trusted_options);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-range-createcontextualfragment
+WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> Range::create_contextual_fragment(TrustedTypes::TrustedHTMLOrString const& string)
+{
+ // 1. Let node be this's start node.
+ GC::Ref<Node> node = *start_container();
+
+ // 2. Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input
+ // algorithm with this's relevant global object, string, a new SetHTMLUnsafeOptions dictionary whose runScripts
+ // member is set to true and whose other members are set to their default values, "Range
+ // createContextualFragment", node's node document's type, and false.
+ // NOTE: A Trusted Types default policy can override the options, for example by setting runScripts to false to
+ // prevent scripts from executing when inserting the returned fragment.
+ auto const [compliant_string, trusted_options] = TRY(HTML::get_trusted_type_compliant_input_for_legacy_sink(node, string, TrustedTypes::InjectionSink::Range_createContextualFragment, HTML::LegacySinkRunScripts::Yes));
+
+ return create_contextual_fragment_for_node(node, compliant_string.to_utf8_but_should_be_ported_to_utf16(), trusted_options);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-range-createcontextualfragment
+WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> Range::create_contextual_fragment(StringView string, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
+{
+ // 1. Let node be this's start node.
+ return create_contextual_fragment_for_node(*start_container(), string, trusted_options);
}
}
diff --git a/Libraries/LibWeb/DOM/Range.h b/Libraries/LibWeb/DOM/Range.h
index a64667f2e27..c176c7d64c6 100644
--- a/Libraries/LibWeb/DOM/Range.h
+++ b/Libraries/LibWeb/DOM/Range.h
@@ -106,7 +106,7 @@ public:
void set_associated_selection(Badge<Selection::Selection>, GC::Ptr<Selection::Selection>);
WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> create_contextual_fragment(TrustedTypes::TrustedHTMLOrString const&);
- WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> create_contextual_fragment(StringView fragment);
+ WebIDL::ExceptionOr<GC::Ref<DocumentFragment>> create_contextual_fragment(StringView fragment, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
template<typename Callback>
void for_each_contained(Callback callback) const
diff --git a/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Libraries/LibWeb/DOM/ShadowRoot.cpp
index 6e295692461..5bb54f60af3 100644
--- a/Libraries/LibWeb/DOM/ShadowRoot.cpp
+++ b/Libraries/LibWeb/DOM/ShadowRoot.cpp
@@ -6,6 +6,7 @@
#include <LibGC/Heap.h>
#include <LibJS/Runtime/Iterator.h>
+#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleSheetList.h>
#include <LibWeb/CSS/StyleSheetState.h>
@@ -19,6 +20,7 @@
#include <LibWeb/DOM/Utils.h>
#include <LibWeb/HTML/AttributeNames.h>
#include <LibWeb/HTML/CustomElements/CustomElementRegistry.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/HTML/HTMLTemplateElement.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
@@ -162,7 +164,7 @@ WebIDL::ExceptionOr<Utf16String> ShadowRoot::inner_html() const
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-innerhtml
-WebIDL::ExceptionOr<void> ShadowRoot::set_inner_html(Utf16View html)
+WebIDL::ExceptionOr<void> ShadowRoot::set_inner_html(Utf16View html, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options)
{
// 2. Let context be this's host.
auto context = this->host();
@@ -172,7 +174,7 @@ WebIDL::ExceptionOr<void> ShadowRoot::set_inner_html(Utf16View html)
// Keep the shadow root as the fragment parsing target so custom element
// creation uses this shadow tree's registry. The host is still used as
// the parser context by the fragment parsing algorithm.
- auto fragment = TRY(Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { *this }, html));
+ auto fragment = TRY(Element::parse_fragment(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { *this }, html, HTML::ParserScriptingMode::Inert, HTML::FragmentFastPath::Allow, trusted_options));
// 4. Replace all with fragment within this.
this->replace_all(fragment);
@@ -200,14 +202,27 @@ WebIDL::ExceptionOr<Utf16String> ShadowRoot::get_html(HTMLSerializationOptions c
options.shadow_roots);
}
-// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-sethtmlunsafe
-WebIDL::ExceptionOr<void> ShadowRoot::set_html_unsafe(StringView html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-sethtml
+WebIDL::ExceptionOr<void> ShadowRoot::set_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
{
- // 2. Unsafely set HTML given this, this's shadow host, and compliantHTML.
- auto markup = Utf16String::from_utf8(html);
- TRY(unsafely_set_html(Variant<GC::Ref<Element>, GC::Ref<DocumentFragment>> { *this }, markup.utf16_view()));
+ // ShadowRoot's setHTML(html, options) method steps are to filter and set HTML given this, html, options, and Safe.
+ return HTML::filter_and_set_html(GC::Ref<DocumentFragment> { *this }, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
- return {};
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-appendhtml
+WebIDL::ExceptionOr<void> ShadowRoot::append_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // ShadowRoot's appendHTML(html, options) method steps are to filter and pre-insert HTML given this, null, html,
+ // options, and Safe.
+ return HTML::filter_and_pre_insert_html(GC::Ref<DocumentFragment> { *this }, nullptr, html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-prependhtml
+WebIDL::ExceptionOr<void> ShadowRoot::prepend_html(Utf16String const& html, Bindings::SetHTMLOptions const& options)
+{
+ // ShadowRoot's prependHTML(html, options) method steps are to filter and pre-insert HTML given this, this's first
+ // child, html, options, and Safe.
+ return HTML::filter_and_pre_insert_html(GC::Ref<DocumentFragment> { *this }, first_child(), html.utf16_view(), &options, HTML::FragmentParserMode::Safe);
}
GC::Ptr<Element> ShadowRoot::active_element()
@@ -412,30 +427,57 @@ WebIDL::ExceptionOr<TrustedTypes::TrustedHTMLOrString> inner_html(DOM::ShadowRoo
WebIDL::ExceptionOr<void> set_inner_html(DOM::ShadowRoot& shadow_root, TrustedTypes::TrustedHTMLOrString const& value)
{
- // 1. Let compliantString be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, the given value, "ShadowRoot innerHTML", and "script".
- auto const compliant_string = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ // 1. Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input
+ // algorithm with this's relevant global object, the given value, a new SetHTMLUnsafeOptions dictionary,
+ // "ShadowRoot innerHTML", this's node document's type, and false.
+ auto const [compliant_string, trusted_options] = TRY(HTML::get_trusted_type_compliant_input_for_legacy_sink(shadow_root, value, TrustedTypes::InjectionSink::ShadowRoot_innerHTML));
+
+ return shadow_root.set_inner_html(compliant_string, trusted_options);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-sethtmlunsafe
+WebIDL::ExceptionOr<void> set_html_unsafe(DOM::ShadowRoot& shadow_root, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "ShadowRoot setHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::relevant_global_object(shadow_root),
- value,
- TrustedTypes::InjectionSink::ShadowRoot_innerHTML,
- "script"_utf16));
+ html,
+ options,
+ TrustedTypes::InjectionSink::ShadowRoot_setHTMLUnsafe));
+
+ // 2. Filter and set HTML given this, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_set_html(GC::Ref<DOM::DocumentFragment> { shadow_root }, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-appendhtmlunsafe
+WebIDL::ExceptionOr<void> append_html_unsafe(DOM::ShadowRoot& shadow_root, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "ShadowRoot appendHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
+ HTML::relevant_global_object(shadow_root),
+ html,
+ options,
+ TrustedTypes::InjectionSink::ShadowRoot_appendHTMLUnsafe));
- return shadow_root.set_inner_html(compliant_string);
+ // 2. Filter and pre-insert HTML given this, null, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_pre_insert_html(GC::Ref<DOM::DocumentFragment> { shadow_root }, nullptr, compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
}
-WebIDL::ExceptionOr<void> set_html_unsafe(DOM::ShadowRoot& shadow_root, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html)
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-shadowroot-prependhtmlunsafe
+WebIDL::ExceptionOr<void> prepend_html_unsafe(DOM::ShadowRoot& shadow_root, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& html, Variant<SetHTMLUnsafeOptions, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
{
- // 1. Let compliantHTML be the result of invoking the Get Trusted Type compliant string algorithm with
- // TrustedHTML, this's relevant global object, html, "ShadowRoot setHTMLUnsafe", and "script".
- auto const compliant_html = TRY(TrustedTypes::get_trusted_type_compliant_string(
- TrustedTypes::TrustedTypeName::TrustedHTML,
+ // 1. Let (compliantHTML, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, html, options, and "ShadowRoot prependHTMLUnsafe".
+ auto const [compliant_html, compliant_options] = TRY(TrustedTypes::get_trusted_type_compliant_input(
HTML::relevant_global_object(shadow_root),
html,
- TrustedTypes::InjectionSink::ShadowRoot_setHTMLUnsafe,
- "script"_utf16));
+ options,
+ TrustedTypes::InjectionSink::ShadowRoot_prependHTMLUnsafe));
- return shadow_root.set_html_unsafe(compliant_html.to_utf8_but_should_be_ported_to_utf16());
+ // 2. Filter and pre-insert HTML given this, this's first child, compliantHTML, compliantOptions, and Unsafe.
+ return HTML::filter_and_pre_insert_html(GC::Ref<DOM::DocumentFragment> { shadow_root }, shadow_root.first_child(), compliant_html.utf16_view(), HTML::to_sanitizer_options(compliant_options), HTML::FragmentParserMode::Unsafe);
}
GC::Ref<CSS::StyleSheetList> style_sheets(DOM::ShadowRoot& shadow_root)
diff --git a/Libraries/LibWeb/DOM/ShadowRoot.h b/Libraries/LibWeb/DOM/ShadowRoot.h
index 1071a4fcd55..43a1c48dc16 100644
--- a/Libraries/LibWeb/DOM/ShadowRoot.h
+++ b/Libraries/LibWeb/DOM/ShadowRoot.h
@@ -63,9 +63,11 @@ public:
virtual EventTarget* get_parent(Event const&) override;
WebIDL::ExceptionOr<Utf16String> inner_html() const;
- WebIDL::ExceptionOr<void> set_inner_html(Utf16View);
+ WebIDL::ExceptionOr<void> set_inner_html(Utf16View, GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> = nullptr);
- WebIDL::ExceptionOr<void> set_html_unsafe(StringView);
+ WebIDL::ExceptionOr<void> set_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> append_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
+ WebIDL::ExceptionOr<void> prepend_html(Utf16String const& html, Bindings::SetHTMLOptions const&);
WebIDL::ExceptionOr<Utf16String> get_html(HTMLSerializationOptions const&) const;
diff --git a/Libraries/LibWeb/DOM/ShadowRoot.idl b/Libraries/LibWeb/DOM/ShadowRoot.idl
index f332c0a13d9..a8a069e79d4 100644
--- a/Libraries/LibWeb/DOM/ShadowRoot.idl
+++ b/Libraries/LibWeb/DOM/ShadowRoot.idl
@@ -18,9 +18,12 @@ enum SlotAssignmentMode { "manual", "named" };
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
partial interface ShadowRoot {
- [FIXME, CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
- // FIXME: setHTMLUnsafe is missing the SetHTMLUnsafeOptions parameter.
- [CEReactions, ImplementedInBindings] undefined setHTMLUnsafe((TrustedHTML or DOMString) html);
+ [CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined appendHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions] undefined prependHTML(DOMString html, optional SetHTMLOptions options = {});
+ [CEReactions, ImplementedInBindings] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined appendHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
+ [CEReactions, ImplementedInBindings] undefined prependHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedHTMLParserOptions) options = {});
DOMString getHTML(optional GetHTMLOptions options = {});
// FIXME: Only the DOMString variant should have the LegacyNullToEmptyString attribute.
diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h
index dd13eccef84..c13b98118ac 100644
--- a/Libraries/LibWeb/Forward.h
+++ b/Libraries/LibWeb/Forward.h
@@ -781,6 +781,8 @@ class RadioButtonGroupRegistry;
class RadioNodeList;
class RemoteNavigable;
class RemoteWindow;
+class Sanitizer;
+struct SanitizerConfiguration;
class ScriptRegistry;
class SessionHistoryEntry;
class SharedResourceRequest;
@@ -1322,6 +1324,7 @@ struct FormDataEntry;
namespace Web::TrustedTypes {
class TrustedHTML;
+class TrustedHTMLParserOptions;
class TrustedScript;
class TrustedScriptURL;
class TrustedTypePolicy;
diff --git a/Libraries/LibWeb/HTML/HTMLInsertion.cpp b/Libraries/LibWeb/HTML/HTMLInsertion.cpp
new file mode 100644
index 00000000000..5d596c9e5c0
--- /dev/null
+++ b/Libraries/LibWeb/HTML/HTMLInsertion.cpp
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibWeb/Bindings/Sanitizer.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/DocumentFragment.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/HTML/HTMLHtmlElement.h>
+#include <LibWeb/HTML/HTMLInsertion.h>
+#include <LibWeb/HTML/HTMLTemplateElement.h>
+#include <LibWeb/HTML/Parser/HTMLParser.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
+#include <LibWeb/HTML/Scripting/Environments.h>
+#include <LibWeb/HTML/TagNames.h>
+#include <LibWeb/Namespace.h>
+#include <LibWeb/TrustedTypes/TrustedHTMLParserOptions.h>
+#include <LibWeb/TrustedTypes/TrustedTypePolicy.h>
+#include <LibWeb/XML/XMLFragmentParser.h>
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#target-for-html-insertion
+HTMLInsertionTarget target_for_html_insertion(DOM::Element& element)
+{
+ // 1. If element is a template element, then return element's template contents.
+ if (auto* template_element = as_if<HTMLTemplateElement>(element))
+ return GC::Ref { *template_element->content() };
+
+ // 2. Return element.
+ return GC::Ref { element };
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#parent-for-html-insertion
+WebIDL::ExceptionOr<Optional<HTMLInsertionTarget>> parent_for_html_insertion(DOM::Node& node)
+{
+ // 1. Let parent be node's parent.
+ auto* parent = node.parent();
+
+ // 2. If parent is null, then return null.
+ if (!parent)
+ return Optional<HTMLInsertionTarget> {};
+
+ // 3. If parent is a template element, then throw a "HierarchyRequestError" DOMException.
+ if (is<HTMLTemplateElement>(*parent))
+ return WebIDL::HierarchyRequestError::create("Cannot insert HTML into the children of a template element"_utf16);
+
+ // 4. If parent is an Element, or a DocumentFragment with a non-null host, then return parent.
+ if (auto* element = as_if<DOM::Element>(*parent))
+ return Optional<HTMLInsertionTarget> { GC::Ref { *element } };
+ if (auto* fragment = as_if<DOM::DocumentFragment>(*parent); fragment && fragment->host())
+ return Optional<HTMLInsertionTarget> { GC::Ref { *fragment } };
+
+ // 5. Throw a "HierarchyRequestError" DOMException.
+ return WebIDL::HierarchyRequestError::create("Cannot insert HTML into this parent"_utf16);
+}
+
+static GC::Ref<DOM::Node> target_node(HTMLInsertionTarget const& target)
+{
+ return target.visit([](auto node) -> GC::Ref<DOM::Node> { return node; });
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#set-and-filter-html
+WebIDL::ExceptionOr<void> filter_and_set_html(HTMLInsertionTarget target, Utf16View html, SanitizerOptions const& options, FragmentParserMode mode)
+{
+ // 1. Let fragment be the result of parsing HTML for insertion given target, html, options, and mode.
+ auto fragment = TRY(parse_html_for_insertion(target, html, options, mode));
+
+ // 2. If fragment is non-null, then replace all with fragment within target.
+ if (fragment)
+ target_node(target)->replace_all(fragment);
+
+ return {};
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#filter-and-pre-insert-html
+WebIDL::ExceptionOr<void> filter_and_pre_insert_html(HTMLInsertionTarget parent, GC::Ptr<DOM::Node> child, Utf16View html, SanitizerOptions const& options, FragmentParserMode mode)
+{
+ // 1. If parent is an html element, then throw a "HierarchyRequestError" DOMException.
+ if (auto element = parent.get_pointer<GC::Ref<DOM::Element>>(); element && is<HTMLHtmlElement>(**element))
+ return WebIDL::HierarchyRequestError::create("Cannot insert HTML into an html element"_utf16);
+
+ // 2. Let fragment be the result of parsing HTML for insertion given parent, html, options, and mode.
+ auto fragment = TRY(parse_html_for_insertion(parent, html, options, mode));
+
+ // 3. If fragment is non-null, then pre-insert fragment into parent before child.
+ if (fragment)
+ TRY(target_node(parent)->pre_insert(*fragment, child));
+
+ return {};
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#filter-and-replace-with-html
+WebIDL::ExceptionOr<void> filter_and_replace_with_html(HTMLInsertionTarget parent, DOM::Node& node, Utf16View html, SanitizerOptions const& options, FragmentParserMode mode)
+{
+ // 1. If parent is an html element, then throw a "HierarchyRequestError" DOMException.
+ if (auto element = parent.get_pointer<GC::Ref<DOM::Element>>(); element && is<HTMLHtmlElement>(**element))
+ return WebIDL::HierarchyRequestError::create("Cannot insert HTML into an html element"_utf16);
+
+ // 2. Let fragment be the result of parsing HTML for insertion given parent, html, options, and mode.
+ auto fragment = TRY(parse_html_for_insertion(parent, html, options, mode));
+
+ // 3. If fragment is non-null, then replace node with fragment within parent.
+ if (fragment)
+ TRY(target_node(parent)->replace_child(*fragment, node));
+
+ return {};
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#parse-html-for-insertion
+WebIDL::ExceptionOr<GC::Ptr<DOM::DocumentFragment>> parse_html_for_insertion(HTMLInsertionTarget target, Utf16View html, SanitizerOptions const& options, FragmentParserMode mode)
+{
+ // 1. If mode is Safe:
+ if (mode == FragmentParserMode::Safe) {
+ // 1. Let context be target if target is an Element; otherwise target's host.
+ GC::Ptr<DOM::Element> context = target.visit(
+ [](GC::Ref<DOM::Element> element) -> GC::Ptr<DOM::Element> { return element; },
+ [](GC::Ref<DOM::DocumentFragment> fragment) -> GC::Ptr<DOM::Element> { return fragment->host(); });
+
+ // 2. Assert: context is non-null.
+ VERIFY(context);
+
+ // 3. If all of the following are true:
+ // - context's local name is "script"; and
+ // - context's namespace is the HTML namespace or the SVG namespace,
+ // then return null.
+ if (context->local_name() == TagNames::script && (context->namespace_uri() == Namespace::HTML || context->namespace_uri() == Namespace::SVG))
+ return nullptr;
+ }
+
+ // 2. Return the result of invoking the fragment parsing algorithm steps given target, html, options, and mode.
+ return TRY(fragment_parsing_algorithm_steps(target, html, options, mode)).ptr();
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#fragment-parsing-algorithm-steps
+WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> fragment_parsing_algorithm_steps(HTMLInsertionTarget target, Utf16View markup, SanitizerOptions const& options, FragmentParserMode mode)
+{
+ // 1. If mode is Legacy and target's node document is an XML document, then return the result of invoking the XML
+ // fragment parsing algorithm given target and markup.
+ // NOTE: Sanitization is not supported for XML documents.
+ if (mode == FragmentParserMode::Legacy && target_node(target)->document().is_xml_document())
+ return XMLFragmentParser::parse_xml_fragment(target, markup);
+
+ // 2. Let safe be true if mode is Safe; otherwise false.
+ auto safety = mode == FragmentParserMode::Safe ? SanitizerSafety::Safe : SanitizerSafety::Unsafe;
+
+ // 3. Let sanitizerConfig be the result of getting a sanitizer config from options given options and safe.
+ auto sanitizer_config = TRY(get_a_sanitizer_config_from_options(options, safety));
+
+ // 4. Let scriptingMode be Inert.
+ auto scripting_mode = ParserScriptingMode::Inert;
+
+ // 5. Let runScripts be options's runScripts if options is a TrustedHTMLParserOptions; otherwise
+ // options["runScripts"] with default false.
+ bool run_scripts = options.visit(
+ [](GC::Ref<TrustedTypes::TrustedHTMLParserOptions> trusted_options) { return trusted_options->run_scripts(); },
+ [](Bindings::SetHTMLUnsafeOptions const* set_html_unsafe_options) { return set_html_unsafe_options->run_scripts; },
+ [](auto const*) { return false; });
+
+ // 6. If runScripts is true:
+ if (run_scripts) {
+ // 1. Assert: mode is not Safe.
+ VERIFY(mode != FragmentParserMode::Safe);
+
+ // 2. Set scriptingMode to Fragment.
+ scripting_mode = ParserScriptingMode::Fragment;
+ }
+
+ // 7. Let allowDeclarativeShadowRoots be false if mode is Legacy; otherwise true.
+ auto allow_declarative_shadow_roots = mode == FragmentParserMode::Legacy ? HTMLParser::AllowDeclarativeShadowRoots::No : HTMLParser::AllowDeclarativeShadowRoots::Yes;
+
+ // 8. Return the result of the HTML fragment parsing algorithm given target, markup, allowDeclarativeShadowRoots,
+ // scriptingMode, and sanitizerConfig.
+ // NOTE: Scripts in the returned fragment will only execute once they are inserted into a document, and only if
+ // scriptingMode is Fragment.
+ return HTMLParser::parse_html_fragment(target, markup, allow_declarative_shadow_roots, scripting_mode, FragmentFastPath::Allow, sanitizer_config.has_value() ? &*sanitizer_config : nullptr);
+}
+
+WebIDL::ExceptionOr<LegacySinkCompliantInput> get_trusted_type_compliant_input_for_legacy_sink(DOM::Node& node, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const& value, TrustedTypes::InjectionSink sink, LegacySinkRunScripts run_scripts)
+{
+ // Let (compliantString, compliantOptions) be the result of invoking the get trusted type compliant input algorithm
+ // with this's relevant global object, the given value, a new SetHTMLUnsafeOptions dictionary, sink, this's node
+ // document's type, and false.
+ Bindings::SetHTMLUnsafeOptions options;
+ options.run_scripts = run_scripts == LegacySinkRunScripts::Yes;
+ auto document_type = node.document().is_xml_document() ? TrustedTypes::DocumentType::XML : TrustedTypes::DocumentType::HTML;
+ auto compliant_input = TRY(TrustedTypes::get_trusted_type_compliant_input(
+ relevant_global_object(node),
+ value,
+ TrustedTypes::CompliantParserOptions<Bindings::SetHTMLUnsafeOptions> { move(options) },
+ sink,
+ document_type,
+ TrustedTypes::OptionsFromAuthor::No));
+
+ GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options;
+ if (auto const* trusted = compliant_input.options.template get_pointer<GC::Ref<TrustedTypes::TrustedHTMLParserOptions>>())
+ trusted_options = *trusted;
+ return LegacySinkCompliantInput { move(compliant_input.html), trusted_options };
+}
+
+}
diff --git a/Libraries/LibWeb/HTML/HTMLInsertion.h b/Libraries/LibWeb/HTML/HTMLInsertion.h
new file mode 100644
index 00000000000..98b17c2324a
--- /dev/null
+++ b/Libraries/LibWeb/HTML/HTMLInsertion.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Utf16View.h>
+#include <AK/Variant.h>
+#include <LibGC/Ptr.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
+#include <LibWeb/TrustedTypes/InjectionSink.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#fragment-parser-mode
+enum class FragmentParserMode : u8 {
+ Safe,
+ Unsafe,
+ Legacy,
+};
+
+using HTMLInsertionTarget = Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::DocumentFragment>>;
+
+HTMLInsertionTarget target_for_html_insertion(DOM::Element&);
+WebIDL::ExceptionOr<Optional<HTMLInsertionTarget>> parent_for_html_insertion(DOM::Node&);
+
+WebIDL::ExceptionOr<void> filter_and_set_html(HTMLInsertionTarget, Utf16View html, SanitizerOptions const&, FragmentParserMode);
+WebIDL::ExceptionOr<void> filter_and_pre_insert_html(HTMLInsertionTarget parent, GC::Ptr<DOM::Node> child, Utf16View html, SanitizerOptions const&, FragmentParserMode);
+WebIDL::ExceptionOr<void> filter_and_replace_with_html(HTMLInsertionTarget parent, DOM::Node&, Utf16View html, SanitizerOptions const&, FragmentParserMode);
+
+WebIDL::ExceptionOr<GC::Ptr<DOM::DocumentFragment>> parse_html_for_insertion(HTMLInsertionTarget, Utf16View html, SanitizerOptions const&, FragmentParserMode);
+WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> fragment_parsing_algorithm_steps(HTMLInsertionTarget, Utf16View markup, SanitizerOptions const&, FragmentParserMode);
+
+// NB: The result of the get trusted type compliant input algorithm for the legacy HTML sinks, which pass a new
+// SetHTMLUnsafeOptions dictionary. trusted_options is null if compliantOptions is that dictionary.
+struct LegacySinkCompliantInput {
+ Utf16String html;
+ GC::Ptr<TrustedTypes::TrustedHTMLParserOptions> trusted_options;
+};
+
+enum class LegacySinkRunScripts : u8 {
+ No,
+ Yes,
+};
+
+WebIDL::ExceptionOr<LegacySinkCompliantInput> get_trusted_type_compliant_input_for_legacy_sink(DOM::Node&, Variant<GC::Ref<TrustedTypes::TrustedHTML>, Utf16String> const&, TrustedTypes::InjectionSink, LegacySinkRunScripts = LegacySinkRunScripts::No);
+
+template<typename Options>
+SanitizerOptions to_sanitizer_options(Variant<Options, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> const& options)
+{
+ return options.visit(
+ [](Options const& dictionary) -> SanitizerOptions { return &dictionary; },
+ [](GC::Ref<TrustedTypes::TrustedHTMLParserOptions> trusted_options) -> SanitizerOptions { return trusted_options; });
+}
+
+}
diff --git a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
index 8b6d23f6504..b4993e81536 100644
--- a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
+++ b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
@@ -58,6 +58,7 @@
#include <LibWeb/HTML/Parser/SpeculativeHTMLParser.h>
#include <LibWeb/HTML/PolicyContainers.h>
#include <LibWeb/HTML/PreloadEntry.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
#include <LibWeb/HTML/Scripting/SimilarOriginWindowAgent.h>
@@ -183,7 +184,10 @@ extern "C" bool ladybird_html_parser_document_is_iframe_srcdoc_document(void*);
extern "C" size_t ladybird_html_parser_create_document_type(void*, u16 const*, size_t, u16 const*, size_t, u16 const*, size_t);
extern "C" size_t ladybird_html_parser_create_comment(void*, u16 const*, size_t);
extern "C" void ladybird_html_parser_insert_text(size_t, size_t, u8 const*, size_t);
-extern "C" void ladybird_html_parser_add_missing_attribute(size_t, size_t, u16 const*, size_t);
+extern "C" void ladybird_html_parser_add_missing_attribute(void*, size_t, size_t, u16 const*, size_t);
+extern "C" u8 ladybird_html_parser_sanitizer_action(void*, size_t);
+extern "C" size_t ladybird_html_parser_child_at_index(size_t, size_t);
+extern "C" u32 ladybird_html_parser_declarative_shadow_root_attributes(size_t);
extern "C" void ladybird_html_parser_remove_node(size_t);
extern "C" void ladybird_html_parser_handle_element_popped(size_t);
extern "C" void ladybird_html_parser_prepare_svg_script(void*, size_t, size_t);
@@ -330,6 +334,12 @@ void HTMLParser::pop_all_open_elements()
rust_html_parser_pop_all_open_elements(m_rust_parser);
}
+void HTMLParser::set_sanitizer_configuration(SanitizerConfiguration const& configuration)
+{
+ m_sanitizer_configuration = configuration;
+ rust_html_parser_set_sanitizer(m_rust_parser, true, sanitizer_config_allows_comments(configuration));
+}
+
void HTMLParser::configure_element_created_by_rust_parser(DOM::Element& element)
{
if (element.local_name() != HTML::TagNames::script || element.namespace_uri() != Namespace::HTML)
@@ -358,7 +368,9 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for_rust_parser(Utf16FlyString
// the element pointed to by the form element pointer, and the parser's insertion target redirection map[the
// element pointed to by the form element pointer] does not exist, then associate element with the form
// element pointed to by the form element pointer and set element's parser inserted flag.
- // FIXME: Check the fragment context element, the full parsing-template-contents predicate, and the redirection map.
+ // FIXME: Check the fragment context element and the full parsing-template-contents predicate.
+ // NB: The Rust tree builder passes a null form element if the insertion target redirection map has an entry for
+ // the element pointed to by the form element pointer.
if (form_element && !has_template_element_on_stack) {
auto* html_element = as_if<HTML::HTMLElement>(*element);
if (html_element && html_element->is_form_associated_element() && !html_element->is_form_associated_custom_element()) {
@@ -1107,29 +1119,46 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for(Utf16FlyString const& local
return {};
};
- // FIXME: 5. Let sanitizerConfig be the parser's parser sanitizer configuration.
- // FIXME: 6. Let sanitizerAction be "Keep".
- // FIXME: 7. If sanitizerConfig is not null, then set sanitizerAction to the result of getting the sanitizer action
- // for an element name given localName, namespace, and sanitizerConfig.
+ // 5. Let sanitizerConfig be the parser's parser sanitizer configuration.
+ auto const* sanitizer_config = sanitizer_configuration();
+
+ // 6. Let sanitizerAction be "Keep".
+ auto sanitizer_action = SanitizerAction::Keep;
+
+ // 7. If sanitizerConfig is not null, then set sanitizerAction to the result of getting the sanitizer action for an
+ // element name given localName, namespace, and sanitizerConfig.
+ if (sanitizer_config)
+ sanitizer_action = sanitizer_action_for_element_name(local_name, namespace_, *sanitizer_config);
// 8. Let is be the value of the "is" attribute in token, if such an attribute exists; otherwise null.
Optional<Utf16FlyString> is_value;
if (auto is_attribute = attribute_value(AttributeNames::is); is_attribute.has_value())
is_value = Utf16FlyString::from_utf8_without_validation(*is_attribute);
- // FIXME: 9. If is is non-null, sanitizerConfig is non-null, and the result of checking if a sanitizer config allows
- // an attribute given "is", null, is, localName, namespace, and sanitizerConfig is false, then set is to null.
+ // 9. If is is non-null, sanitizerConfig is non-null, and the result of checking if a sanitizer config allows an
+ // attribute given "is", null, is, localName, namespace, and sanitizerConfig is false, then set is to null.
+ if (is_value.has_value() && sanitizer_config
+ && !sanitizer_config_allows_attribute(AttributeNames::is, {}, is_value->view(), local_name, namespace_, *sanitizer_config)) {
+ is_value = {};
+ }
// 10. Let registry be the result of looking up a custom element registry given intendedParent.
auto registry = look_up_a_custom_element_registry(intended_parent);
// 11. Let creationRegistry be registry if sanitizerAction is "Keep"; otherwise null.
- // NB: Without a sanitizer configuration, creationRegistry is registry.
+ // NOTE: Elements that the sanitizer will remove or replace with their children are created with a null custom
+ // element registry, so creating an element finds no custom element definition and no custom element
+ // constructor runs for them. Removed elements keep the null registry, so their descendants, which look up
+ // their registry from them, don't run constructors either. Replaced elements have their registry set to
+ // registry after creation so that their children inherit it. Likewise, an is attribute that the sanitizer
+ // will remove does not create a customized built-in element.
+ GC::Ptr<CustomElementRegistry> creation_registry = sanitizer_action == SanitizerAction::Keep ? registry : nullptr;
// 12. Let definition be null if sanitizerAction is not "Keep"; otherwise the result of looking up a custom element
// definition given registry, namespace, localName, and is.
- // FIXME: Handle sanitizer actions other than "Keep".
- auto definition = look_up_a_custom_element_definition(registry, namespace_, local_name, is_value);
+ GC::Ptr<CustomElementDefinition> definition;
+ if (sanitizer_action == SanitizerAction::Keep)
+ definition = look_up_a_custom_element_definition(registry, namespace_, local_name, is_value);
// 13. Let willExecuteScript be true if definition is non-null and the parser's fragment context element is null;
// otherwise false.
@@ -1151,8 +1180,8 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for(Utf16FlyString const& local
// 15. Let element be the result of creating an element given document, localName, namespace, prefix, is,
// willExecuteScript, and creationRegistry.
- // NB: This helper currently implements only the default null prefix and the unsanitized creation registry.
- auto element = DOM::create_element(*document, local_name, namespace_, {}, is_value, will_execute_script, registry).release_value_but_fixme_should_propagate_errors();
+ // NB: This helper currently implements only the default null prefix.
+ auto element = DOM::create_element(*document, local_name, namespace_, {}, is_value, will_execute_script, creation_registry).release_value_but_fixme_should_propagate_errors();
// AD-HOC: Let <link> elements know which document they were originally parsed for.
// This is used for the render-blocking logic.
@@ -1167,23 +1196,34 @@ GC::Ref<DOM::Element> HTMLParser::create_element_for(Utf16FlyString const& local
if (auto* style_element = as_if<DOM::StyleElementBase>(*element))
style_element->set_parser_document({}, document);
- // FIXME: 16. If sanitizerAction is "Replace with children", then set element's custom element registry to registry.
+ // 16. If sanitizerAction is "Replace with children", then set element's custom element registry to registry.
+ if (sanitizer_action == SanitizerAction::ReplaceWithChildren)
+ element->set_custom_element_registry(registry);
// 17. For each attribute of token's attributes:
element->ensure_attribute_capacity(attributes.size());
for (auto const& attribute : attributes) {
- // FIXME: 1. If sanitizerConfig is not null:
- // 1. Let attrLocalName be attribute's local name if attribute is a namespaced attribute; otherwise
- // attribute's name.
- // 2. Let attrNamespace be attribute's namespace if attribute is a namespaced attribute; otherwise null.
- // 3. If the result of checking if a sanitizer config allows an attribute given attrLocalName,
- // attrNamespace, attribute's value, localName, namespace, and sanitizerConfig is false, then continue.
+ auto attribute_local_name = Utf16FlyString::from_raw(attribute.local_name);
+ auto attribute_namespace = attribute_namespace_from_html_parser_ffi(attribute.namespace_);
+ auto value = utf8_string_from_ffi(attribute.value_ptr, attribute.value_len);
+
+ // 1. If sanitizerConfig is not null:
+ if (sanitizer_config) {
+ // 1. Let attrLocalName be attribute's local name if attribute is a namespaced attribute; otherwise
+ // attribute's name.
+ // 2. Let attrNamespace be attribute's namespace if attribute is a namespaced attribute; otherwise null.
+ // 3. If the result of checking if a sanitizer config allows an attribute given attrLocalName,
+ // attrNamespace, attribute's value, localName, namespace, and sanitizerConfig is false, then continue.
+ if (!sanitizer_config_allows_attribute(attribute_local_name, attribute_namespace, value.utf16_view(), local_name, namespace_, *sanitizer_config))
+ continue;
+ }
+
Optional<Utf16FlyString> prefix;
if (attribute.prefix_len != 0)
prefix = Utf16FlyString::from_utf8_without_validation({ reinterpret_cast<char const*>(attribute.prefix_ptr), attribute.prefix_len });
- DOM::QualifiedName qualified_name { Utf16FlyString::from_raw(attribute.local_name), move(prefix), attribute_namespace_from_html_parser_ffi(attribute.namespace_) };
+ DOM::QualifiedName qualified_name { move(attribute_local_name), move(prefix), move(attribute_namespace) };
// 2. Append attribute to element.
- element->append_attribute(move(qualified_name), utf8_string_from_ffi(attribute.value_ptr, attribute.value_len));
+ element->append_attribute(move(qualified_name), move(value));
}
// AD-HOC: The muted attribute on media elements is only set if the muted content attribute is present when the element is first created.
@@ -1800,10 +1840,8 @@ GC::Ptr<DOM::DocumentFragment> HTMLParser::try_parse_html_fragment_fast(DOM::Ele
}
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
-WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragment(Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::DocumentFragment>> target, Utf16View input, AllowDeclarativeShadowRoots allow_declarative_shadow_roots, ParserScriptingMode scripting_mode, FragmentFastPath fast_path)
+WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragment(Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::DocumentFragment>> target, Utf16View input, AllowDeclarativeShadowRoots allow_declarative_shadow_roots, ParserScriptingMode scripting_mode, FragmentFastPath fast_path, SanitizerConfiguration const* configuration)
{
- // FIXME: Support the optional sanitizer configuration argument.
-
// 1. Assert: scriptingMode is either Inert or Fragment.
VERIFY(scripting_mode == HTML::ParserScriptingMode::Inert || scripting_mode == HTML::ParserScriptingMode::Fragment);
@@ -1816,18 +1854,29 @@ WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragm
VERIFY(context);
// OPTIMIZATION: A validated subset of in-body fragments can be constructed directly from input spans.
- if (fast_path == FragmentFastPath::Allow && target.has<GC::Ref<DOM::Element>>()) {
+ // NB: The fast path does not sanitize, so it is never used with a sanitizer configuration.
+ if (fast_path == FragmentFastPath::Allow && !configuration && target.has<GC::Ref<DOM::Element>>()) {
if (auto fragment = try_parse_html_fragment_fast(*context, input))
return GC::Ref { *fragment };
}
// 4. Let document be a Document node whose type is "html".
-
// 5. Let contextDocument be context's node document.
auto& context_document = context->document();
- // 6. If contextDocument is in quirks mode, then set document's mode to "quirks".
- // 7. Otherwise, if contextDocument is in limited-quirks mode, then set document's mode to "limited-quirks".
+ // OPTIMIZATION: Without a sanitizer configuration, the parser uses the context document directly, see below.
+ // When sanitizing, the nodes are created in a new document instead, so that elements that the
+ // sanitizer removes are never created in the context document, where their creation could have
+ // side effects.
+ GC::Ref<DOM::Document> document = context_document;
+ if (configuration) {
+ document = DOM::Document::create_for_fragment_parsing(context_document.page(), context_document.relevant_global_event_target());
+ document->set_document_type(DOM::Document::Type::HTML);
+
+ // 6. If contextDocument is in quirks mode, then set document's mode to "quirks".
+ // 7. Otherwise, if contextDocument is in limited-quirks mode, then set document's mode to "limited-quirks".
+ document->set_quirks_mode(context_document.mode());
+ }
// 8. If contextDocument's scripting is disabled, then set scriptingMode to Disabled.
if (context_document.is_scripting_disabled())
@@ -1836,11 +1885,12 @@ WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragm
// 9. Create a new HTML parser whose parser sanitizer configuration is configuration, allow declarative shadow
// roots is allowDeclarativeShadowRoots, scripting mode is scriptingMode, and fragment context element is
// context, and associate it with document.
- // NB: The currently supported calls use a null sanitizer configuration.
- // OPTIMIZATION: Use the context document directly while keeping the parser detached from its document parser state.
- // The detached root below supplies the temporary tree-builder state, while all output nodes are
- // created for their final document. This avoids initializing a complete Document for every fragment.
- auto parser = GC::Heap::the().allocate<HTMLParser>(context_document, scripting_mode, input, FragmentParser::Yes);
+ // NB: The parser sanitizer configuration is set below, once the Rust parser state has been initialized.
+ // OPTIMIZATION: Without a sanitizer configuration, use the context document directly while keeping the parser
+ // detached from its document parser state. The detached root below supplies the temporary
+ // tree-builder state, while all output nodes are created for their final document. This avoids
+ // initializing a complete Document for every fragment.
+ auto parser = GC::Heap::the().allocate<HTMLParser>(*document, scripting_mode, input, FragmentParser::Yes);
parser->initialize(context_document.relevant_settings_object().realm());
parser->set_allow_declarative_shadow_roots(allow_declarative_shadow_roots);
parser->m_context_element = context; // FIXME: Is this needed?
@@ -1890,7 +1940,7 @@ WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragm
// 11. Let root be the result of creating an element given document, "html", the HTML namespace, null, null, false,
// and the result of looking up a custom element registry given target.
auto root_registry = look_up_a_custom_element_registry(target_node);
- auto root = MUST(DOM::create_element(context_document, HTML::TagNames::html, Namespace::HTML, {}, {}, false, root_registry));
+ auto root = MUST(DOM::create_element(*document, HTML::TagNames::html, Namespace::HTML, {}, {}, false, root_registry));
// 12. Append root to document.
// OPTIMIZATION: Keep the root detached. It is only a sentinel for the tree builder, whose root insertions are
@@ -1899,7 +1949,7 @@ WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragm
// 13. Set up the HTML parser's stack of open elements so that it contains just the single element root.
// 14. Let fragment be the result of creating a document fragment given document if configuration is non-null;
// otherwise target's node document.
- auto fragment = DOM::DocumentFragment::create(target_node->document());
+ auto fragment = DOM::DocumentFragment::create(configuration ? *document : target_node->document());
// 15. Set the parser's insertion target redirection map[root] to (fragment, null).
// NB: m_root_insertion_target represents the root entry of the insertion target redirection map.
@@ -1968,13 +2018,19 @@ WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> HTMLParser::parse_html_fragm
allow_declarative_shadow_roots == AllowDeclarativeShadowRoots::Yes,
parser->m_form_element ? reinterpret_cast<size_t>(parser->m_form_element.ptr()) : 0);
+ // NB: The parser sanitizer configuration is set after the Rust parser state has been initialized for the fragment.
+ if (configuration)
+ parser->set_sanitizer_configuration(*configuration);
+
// 20. Place the input into the input stream for the HTML parser just created. The encoding confidence is irrelevant.
// NB: The input was supplied when constructing the parser above.
// 21. Start the HTML parser and let it run until it has consumed all the characters just inserted into the input stream.
parser->run_until_completion();
// 22. Adopt fragment into target's node document.
- // NB: The fragment is already in the target's node document.
+ // NB: Without a sanitizer configuration, the fragment is already in the target's node document.
+ if (configuration)
+ target_node->document().adopt_node_steps(fragment);
// 23. Return fragment.
return fragment;
@@ -2945,16 +3001,73 @@ extern "C" void ladybird_html_parser_insert_text(size_t parent, size_t offset, u
insert_node_for_parser(parent_node, *text, insertion_location.child_at_offset());
}
-extern "C" void ladybird_html_parser_add_missing_attribute(size_t element, size_t local_name_raw, u16 const* value_ptr, size_t value_len)
+// https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
+// NB: The steps for each attribute of an "html" or "body" start tag token in the "in body" insertion mode.
+extern "C" void ladybird_html_parser_add_missing_attribute(void* parser, size_t element, size_t local_name_raw, u16 const* value_ptr, size_t value_len)
{
auto& dom_element = as<DOM::Element>(node_from_html_parser_ffi(element));
auto local_name = Utf16FlyString::from_raw(local_name_raw);
+ auto value = utf16_string_from_ffi(value_ptr, value_len);
+
+ // 1. If the parser's parser sanitizer configuration is not null and the result of checking if a sanitizer config
+ // allows an attribute given attribute's name, null, attribute's value, element's local name, element's
+ // namespace, and the parser's parser sanitizer configuration is false, then continue.
+ if (auto const* sanitizer_config = parser_from_html_parser_ffi(parser).sanitizer_configuration();
+ sanitizer_config && !sanitizer_config_allows_attribute(local_name, {}, value.utf16_view(), dom_element.local_name(), dom_element.namespace_uri(), *sanitizer_config)) {
+ return;
+ }
+
+ // 2. If element does not have an attribute whose name is attribute's name, then add attribute's name and its
+ // corresponding value to element.
if (dom_element.has_attribute(local_name))
return;
- auto value = utf16_string_from_ffi(value_ptr, value_len);
dom_element.append_attribute(DOM::QualifiedName { move(local_name), {}, {} }, move(value));
}
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#get-the-sanitizer-action-for-an-element-name
+// NB: Returns the sanitizer action for element's local name and namespace, given the parser's parser sanitizer
+// configuration, which must not be null.
+extern "C" u8 ladybird_html_parser_sanitizer_action(void* parser, size_t element)
+{
+ auto const* sanitizer_config = parser_from_html_parser_ffi(parser).sanitizer_configuration();
+ VERIFY(sanitizer_config);
+ auto& dom_element = as<DOM::Element>(node_from_html_parser_ffi(element));
+ return to_underlying(sanitizer_action_for_element_name(dom_element.local_name(), dom_element.namespace_uri(), *sanitizer_config));
+}
+
+extern "C" size_t ladybird_html_parser_child_at_index(size_t parent, size_t index)
+{
+ auto& parent_node = node_from_html_parser_ffi(parent);
+ if (index >= parent_node.child_count())
+ return 0;
+ return reinterpret_cast<size_t>(parent_node.child_at_index(index));
+}
+
+// NB: Returns the shadowroot* attribute states of a template element, encoded as bit flags for the Rust tree builder.
+extern "C" u32 ladybird_html_parser_declarative_shadow_root_attributes(size_t element)
+{
+ auto& template_element = as<HTMLTemplateElement>(node_from_html_parser_ffi(element));
+ u32 result = 0;
+ auto mode = template_element.get_attribute(HTML::AttributeNames::shadowrootmode);
+ if (mode.has_value()) {
+ if (mode->equals_ignoring_ascii_case("open"sv))
+ result |= 1;
+ else if (mode->equals_ignoring_ascii_case("closed"sv))
+ result |= 2;
+ }
+ if (template_element.has_attribute(HTML::AttributeNames::shadowrootdelegatesfocus))
+ result |= 1 << 2;
+ if (template_element.has_attribute(HTML::AttributeNames::shadowrootserializable))
+ result |= 1 << 3;
+ if (auto slot_assignment = template_element.get_attribute(HTML::AttributeNames::shadowrootslotassignment); slot_assignment.has_value() && slot_assignment->equals_ignoring_ascii_case("manual"sv))
+ result |= 1 << 4;
+ if (template_element.has_attribute(HTML::AttributeNames::shadowrootclonable))
+ result |= 1 << 5;
+ if (template_element.has_attribute(HTML::AttributeNames::shadowrootcustomelementregistry))
+ result |= 1 << 6;
+ return result;
+}
+
extern "C" void ladybird_html_parser_remove_node(size_t node)
{
node_from_html_parser_ffi(node).remove(true);
diff --git a/Libraries/LibWeb/HTML/Parser/HTMLParser.h b/Libraries/LibWeb/HTML/Parser/HTMLParser.h
index df107663fe9..e30f53d58e2 100644
--- a/Libraries/LibWeb/HTML/Parser/HTMLParser.h
+++ b/Libraries/LibWeb/HTML/Parser/HTMLParser.h
@@ -20,6 +20,7 @@
#include <LibWeb/HTML/Parser/HTMLEncodingDetection.h>
#include <LibWeb/HTML/Parser/HTMLTokenizer.h>
#include <LibWeb/HTML/Parser/ParserScriptingMode.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
#include <LibWeb/Platform/Timer.h>
#include <LibWebCommon/MimeSniff/MimeType.h>
@@ -62,7 +63,7 @@ public:
};
static WebIDL::ExceptionOr<GC::Ref<DOM::DocumentFragment>> parse_html_fragment(Variant<GC::Ref<DOM::Element>, GC::Ref<DOM::DocumentFragment>> target, Utf16View markup,
- AllowDeclarativeShadowRoots = AllowDeclarativeShadowRoots::No, ParserScriptingMode = ParserScriptingMode::Inert, FragmentFastPath = FragmentFastPath::Allow);
+ AllowDeclarativeShadowRoots = AllowDeclarativeShadowRoots::No, ParserScriptingMode = ParserScriptingMode::Inert, FragmentFastPath = FragmentFastPath::Allow, SanitizerConfiguration const* = nullptr);
// Parses a restricted subset of in-body markup in context. On success, appends the parsed top-level nodes to
// top_level_nodes. Their subtrees are linked without running the insertion steps, which inserting each top-level
@@ -85,6 +86,10 @@ public:
void set_allow_declarative_shadow_roots(AllowDeclarativeShadowRoots allow) { m_allow_declarative_shadow_roots = allow; }
+ // https://html.spec.whatwg.org/multipage/parsing.html#parser-sanitizer-configuration
+ SanitizerConfiguration const* sanitizer_configuration() const { return m_sanitizer_configuration.has_value() ? &*m_sanitizer_configuration : nullptr; }
+ void set_sanitizer_configuration(SanitizerConfiguration const&);
+
void configure_element_created_by_rust_parser(DOM::Element&);
GC::Ref<DOM::Element> create_element_for_rust_parser(Utf16FlyString const&, ReadonlySpan<RustFfiHtmlParserAttribute>, Optional<Utf16FlyString> const& namespace_, DOM::Node& intended_parent, bool had_duplicate_attribute, GC::Ptr<HTMLFormElement>, bool has_template_element_on_stack);
void prepare_svg_script_for_rust_parser(SVG::SVGScriptElement&, size_t source_line_number);
@@ -163,6 +168,9 @@ private:
// https://html.spec.whatwg.org/multipage/parsing.html#allow-declarative-shadow-roots
AllowDeclarativeShadowRoots m_allow_declarative_shadow_roots { AllowDeclarativeShadowRoots::No };
+ // https://html.spec.whatwg.org/multipage/parsing.html#parser-sanitizer-configuration
+ Optional<SanitizerConfiguration> m_sanitizer_configuration;
+
bool m_script_created { false };
bool m_aborted { false };
diff --git a/Libraries/LibWeb/HTML/Parser/Rust/src/parser.rs b/Libraries/LibWeb/HTML/Parser/Rust/src/parser.rs
index a5d299f03fd..bff64b16ded 100644
--- a/Libraries/LibWeb/HTML/Parser/Rust/src/parser.rs
+++ b/Libraries/LibWeb/HTML/Parser/Rust/src/parser.rs
@@ -15,6 +15,7 @@ use crate::token::TokenPayload;
use crate::token::TokenType;
use crate::tokenizer::HtmlTokenizer;
use crate::tokenizer::State;
+use std::collections::HashMap;
use std::ffi::c_void;
use std::ops::Deref;
use std::ops::DerefMut;
@@ -122,6 +123,7 @@ unsafe extern "C" {
fn ladybird_html_parser_create_comment(parser: *mut c_void, data_ptr: *const u16, data_len: usize) -> usize;
fn ladybird_html_parser_insert_text(parent: usize, offset: usize, data_ptr: *const u8, data_len: usize);
fn ladybird_html_parser_add_missing_attribute(
+ parser: *mut c_void,
element: usize,
local_name: usize,
value_ptr: *const u16,
@@ -169,9 +171,37 @@ unsafe extern "C" {
) -> usize;
fn ladybird_html_parser_set_template_content(element: usize, content: usize);
fn ladybird_html_parser_is_shadow_host(node: usize) -> bool;
+ fn ladybird_html_parser_sanitizer_action(parser: *mut c_void, element: usize) -> u8;
+ fn ladybird_html_parser_child_at_index(parent: usize, index: usize) -> usize;
+ fn ladybird_html_parser_declarative_shadow_root_attributes(element: usize) -> u32;
fn ladybird_html_parser_set_script_text_from_parser(element: usize);
}
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-action
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+enum SanitizerAction {
+ Keep,
+ Remove,
+ ReplaceWithChildren,
+}
+
+// NB: Bit flags returned by ladybird_html_parser_declarative_shadow_root_attributes().
+const SHADOW_ROOT_MODE_OPEN: u32 = 1;
+const SHADOW_ROOT_MODE_CLOSED: u32 = 1 << 1;
+const SHADOW_ROOT_DELEGATES_FOCUS: u32 = 1 << 2;
+const SHADOW_ROOT_SERIALIZABLE: u32 = 1 << 3;
+const SHADOW_ROOT_SLOT_ASSIGNMENT_MANUAL: u32 = 1 << 4;
+const SHADOW_ROOT_CLONABLE: u32 = 1 << 5;
+const SHADOW_ROOT_CUSTOM_ELEMENT_REGISTRY: u32 = 1 << 6;
+
+// NB: An insertion location whose reference child is stored as a node, so that it stays valid while nodes are inserted
+// before it. A null reference child is represented by 0.
+#[derive(Clone, Copy, Debug)]
+struct RedirectedInsertionLocation {
+ parent: usize,
+ reference_child: usize,
+}
+
/// Opaque handle for the Rust HTML parser, passed across the FFI boundary.
pub struct RustFfiHtmlParserHandle {
state: ParserState,
@@ -366,6 +396,14 @@ struct ParserState {
parser_pause_requested: bool,
foster_parenting_enabled: bool,
frameset_ok: bool,
+ // https://html.spec.whatwg.org/multipage/parsing.html#parser-sanitizer-configuration
+ // NB: The configuration itself lives on the C++ side. These record whether it is non-null and whether it allows
+ // comments.
+ sanitizing: bool,
+ sanitizer_allows_comments: bool,
+ // https://html.spec.whatwg.org/multipage/parsing.html#insertion-target-redirection-map
+ // NB: The entry for the root element of the HTML fragment parsing algorithm is represented by root_insertion_target.
+ insertion_target_redirection_map: HashMap<usize, RedirectedInsertionLocation>,
}
impl ParserState {
@@ -394,6 +432,9 @@ impl ParserState {
parser_pause_requested: false,
foster_parenting_enabled: false,
frameset_ok: true,
+ sanitizing: false,
+ sanitizer_allows_comments: false,
+ insertion_target_redirection_map: HashMap::new(),
}
}
@@ -456,6 +497,11 @@ impl ParserState {
}
visit_node(visitor, self.pending_script.unwrap_or(0));
visit_node(visitor, self.pending_svg_script.unwrap_or(0));
+ for (element, location) in &self.insertion_target_redirection_map {
+ visit_node(visitor, *element);
+ visit_node(visitor, location.parent);
+ visit_node(visitor, location.reference_child);
+ }
}
// https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately
@@ -3419,7 +3465,12 @@ impl TreeBuilder {
token.had_duplicate_attribute(),
);
self.recycle_attribute_buffers(attributes);
- self.append_child(document, element);
+ // NB: When the parser's parser sanitizer configuration is not null, the element is inserted as described in
+ // "insert an element at the adjusted insertion location" with (the Document, null), so that a removed html
+ // element is not inserted.
+ if self.sanitizer_action(element) == SanitizerAction::Keep {
+ self.append_child(document, element);
+ }
self.stack_of_open_elements.push(StackNode {
handle: element,
local_name: local_name.clone(),
@@ -3488,7 +3539,7 @@ impl TreeBuilder {
// the DOM.
// NB: Deferred template insertion skips this step using the implementation parameter.
if !only_add_to_element_stack {
- self.insert_element_at_adjusted_insertion_location(element, None);
+ self.insert_element_at_adjusted_insertion_location(element, None, false);
}
let template_content = if namespace_ == RustFfiHtmlNamespace::Html && local_name == tag_name!("template") {
Some(self.template_content(element))
@@ -3515,7 +3566,7 @@ impl TreeBuilder {
) -> usize {
let adjusted_insertion_location = self.appropriate_place_for_inserting_node(Some(parent));
let element = self.create_html_element_for_active_formatting_element(entry, adjusted_insertion_location.parent);
- self.insert_element_at_adjusted_insertion_location(element, None);
+ self.insert_element_at_adjusted_insertion_location(element, None, false);
self.stack_of_open_elements.push(StackNode {
handle: element,
local_name: entry.local_name.clone(),
@@ -3566,7 +3617,12 @@ impl TreeBuilder {
) -> usize {
// https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token
// AD-HOC: DOM node construction stays on the C++ side of LibWeb, so this step crosses the FFI boundary.
- let form_element = self.form_element.unwrap_or(0);
+ // NB: An element is not associated with a form element that was replaced with its children as part of
+ // sanitization, see step 21 of "create an element for the token".
+ let form_element = self
+ .form_element
+ .filter(|form_element| !self.insertion_target_redirection_map.contains_key(form_element))
+ .unwrap_or(0);
let has_template_element_on_stack = self.has_template_element_on_stack_of_open_elements();
let namespace_uri = namespace_uri.map(|namespace_uri| namespace_uri.encode_utf16().collect::<Vec<_>>());
unsafe {
@@ -3673,11 +3729,59 @@ impl TreeBuilder {
};
}
+ // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#get-the-sanitizer-action-for-an-element-name
+ // NB: Returns "Keep" when the parser's parser sanitizer configuration is null.
+ fn sanitizer_action(&self, element: usize) -> SanitizerAction {
+ if !self.sanitizing {
+ return SanitizerAction::Keep;
+ }
+ match unsafe { ladybird_html_parser_sanitizer_action(self.host, element) } {
+ 0 => SanitizerAction::Keep,
+ 1 => SanitizerAction::Remove,
+ 2 => SanitizerAction::ReplaceWithChildren,
+ _ => unreachable!(),
+ }
+ }
+
+ fn set_insertion_target_redirection(&mut self, element: usize, location: AdjustedInsertionLocation) {
+ let reference_child = if location.offset == APPEND_CHILD_OFFSET {
+ 0
+ } else {
+ unsafe { ladybird_html_parser_child_at_index(location.parent, location.offset) }
+ };
+ self.insertion_target_redirection_map.insert(
+ element,
+ RedirectedInsertionLocation {
+ parent: location.parent,
+ reference_child,
+ },
+ );
+ }
+
+ fn insertion_target_redirection(&self, target_parent: usize) -> Option<AdjustedInsertionLocation> {
+ if self.insertion_target_redirection_map.is_empty() {
+ return None;
+ }
+ let location = self.insertion_target_redirection_map.get(&target_parent)?;
+ // AD-HOC: If the reference child has been removed or moved to another node, nodes are instead appended to the
+ // parent.
+ let offset = if location.reference_child != 0 && self.parent_node(location.reference_child) == location.parent {
+ self.node_index(location.reference_child)
+ } else {
+ APPEND_CHILD_OFFSET
+ };
+ Some(AdjustedInsertionLocation {
+ parent: location.parent,
+ offset,
+ })
+ }
+
// https://html.spec.whatwg.org/multipage/parsing.html#insert-an-element-at-the-adjusted-insertion-location
fn insert_element_at_adjusted_insertion_location(
&mut self,
element: usize,
insertion_location: Option<AdjustedInsertionLocation>,
+ already_sanitized: bool,
) {
// 1. Let (targetParent, referenceChild) be the adjusted insertion location given overrideLocation.
// NB: The implementation names overrideLocation insertion_location.
@@ -3688,8 +3792,43 @@ impl TreeBuilder {
// - element is a host-including inclusive ancestor of targetParent; or
// - targetParent is a Document node that already has an element child,
// then return.
- // FIXME: 3. If alreadySanitized is false and the parser's parser sanitizer configuration is not null:
- // FIXME: Implement the sanitizer action, attribute assertions, and insertion-target redirection for this step.
+
+ // 3. If alreadySanitized is false and the parser's parser sanitizer configuration is not null:
+ if !already_sanitized && self.sanitizing {
+ // 1. Let action be the result of getting the sanitizer action for an element name given element's local
+ // name, element's namespace, and the parser's parser sanitizer configuration.
+ let action = self.sanitizer_action(element);
+
+ // 2. For each attribute of element's attribute list:
+ // 1. Assert: the result of checking if a sanitizer config allows an attribute given attribute's local
+ // name, attribute's namespace, attribute's value, element's local name, element's namespace, and the
+ // parser's parser sanitizer configuration is true.
+ // NOTE: Attributes are sanitized when the element is created from the token.
+
+ // 3. Assert: if targetParent is a Document, then action is not "Replace with children".
+ debug_assert!(
+ action != SanitizerAction::ReplaceWithChildren
+ || insertion_location.parent != unsafe { ladybird_html_parser_document_node(self.host) }
+ );
+
+ // 4. Switch on action:
+ match action {
+ // -> "Replace with children"
+ // Set the parser's insertion target redirection map[element] to (targetParent, referenceChild),
+ // and return.
+ SanitizerAction::ReplaceWithChildren => {
+ self.set_insertion_target_redirection(element, insertion_location);
+ return;
+ }
+ // -> "Remove"
+ // Return.
+ SanitizerAction::Remove => return,
+ // -> "Keep"
+ // Do nothing.
+ SanitizerAction::Keep => {}
+ }
+ }
+
// FIXME: 4. Assert: ensure pre-insert validity given element, targetParent, referenceChild, and « » does not throw.
// 5. If the parser's fragment context element is null, then push a new element queue onto element's relevant
// agent's custom element reactions stack.
@@ -3780,145 +3919,160 @@ impl TreeBuilder {
self.stack_of_template_insertion_modes.push(InsertionMode::InTemplate);
// FIXME: 6. Let declarativeShadowHostElement be the current node.
+ // FIXME: Use the current node for declarativeShadowHostElement, rather than the adjusted current node. A top-level
+ // template in a fragment must not attach a shadow root to its fragment context element.
+ let adjusted_current_node = self.adjusted_current_node().map(|node| node.handle);
+ let declarative_shadow_host_element = adjusted_current_node.unwrap_or(0);
+
// 7. Let hostIsRoot be true if declarativeShadowHostElement is the topmost element in the stack of open elements;
// otherwise false.
- // FIXME: 8. Let template be the result of creating an element for the token given templateStartTag, the HTML
- // namespace, and the target parent of the appropriate place for inserting a node.
- // 9. Let insertionLocation be the appropriate place for inserting a node.
- // FIXME: Create template before computing insertionLocation and inspecting its attributes.
- // NB: The implementation still selects a host and mode before the deferred template-creation helper below.
- let adjusted_insertion_location = self.appropriate_place_for_inserting_node(None);
-
- // 10. Push template onto the stack of open elements so that it is the new current node.
- // NB: The deferred template-creation helper below performs this push.
- // 11. Let sanitizerAction be "Keep".
- // FIXME: 12. If the parser's parser sanitizer configuration is not null, then set sanitizerAction to the result of
- // getting the sanitizer action for an element name given template's local name, template's namespace,
- // and the parser's parser sanitizer configuration.
- // 13. Switch on sanitizerAction:
- // FIXME: -> "Remove"
- // -> "Replace with children"
- // Return.
- // -> "Keep"
- // If template's shadowrootmode attribute is not in the None state:
- // FIXME: Read the mode and flags from the created template, rather than from templateStartTag.
- let mode = match token.attribute(attribute_name!("shadowrootmode")) {
- Some(value) if value.eq_ignore_ascii_case("open") => Some(RustFfiHtmlShadowRootMode::Open),
- Some(value) if value.eq_ignore_ascii_case("closed") => Some(RustFfiHtmlShadowRootMode::Closed),
- _ => None,
- };
-
- // NB: The mode and allow-declarative-shadow-roots checks are combined with the host check below.
- let parser_allows_declarative_shadow_roots = self.allow_declarative_shadow_roots;
-
- // FIXME: Use the current node for declarativeShadowHostElement (step 6), rather than the adjusted current node.
- // A top-level template in a fragment must not attach a shadow root to its fragment context element.
- let adjusted_current_node = self.adjusted_current_node().map(|node| node.handle);
- let adjusted_current_node_is_not_topmost_element = adjusted_current_node.is_some_and(|adjusted_current_node| {
+ let host_is_root = !adjusted_current_node.is_some_and(|adjusted_current_node| {
self.stack_of_open_elements
.first()
.is_none_or(|topmost_element| topmost_element.handle != adjusted_current_node)
});
- // If any of the following are true:
- // - the parser's allow declarative shadow roots is false;
- // - hostIsRoot is true; or
- // - the parser's insertion target redirection map[declarativeShadowHostElement] exists,
- // then insert an element at the adjusted insertion location with template, insertionLocation, and true, and return.
- // FIXME: Check the insertion target redirection map when sanitizer redirection is supported.
- // NB: The ordinary-template case is also handled by this combined fallback.
- if mode.is_none() || !parser_allows_declarative_shadow_roots || !adjusted_current_node_is_not_topmost_element {
- // FIXME: Otherwise, if template has a for attribute:
- // 1. Let scope be the target parent of the adjusted insertion location given insertionLocation.
- // 2. If scope is the body element of its node document, then set scope to its parent.
- // 3. Let success be the result of preparing content patching given scope and template.
- // 4. If success is false, then insert an element at the adjusted insertion location with template,
- // insertionLocation, and true.
- // NB: Templates currently fall back to ordinary insertion without content-patching support.
- self.insert_html_element_for(token);
- return;
- }
-
- // NB: Continue with the host selected by the checks above.
- let declarative_shadow_host_element = adjusted_current_node.unwrap();
-
- // NB: This helper creates template (step 8) and pushes it (step 10) without inserting it into the DOM.
+ // 8. Let template be the result of creating an element for the token given templateStartTag, the HTML
+ // namespace, and the target parent of the appropriate place for inserting a node.
+ // 9. Let insertionLocation be the appropriate place for inserting a node.
+ // NOTE: This is computed after template is created, since creating a customized built-in element can run
+ // script that changes the DOM, and before template is pushed onto the stack of open elements, since
+ // afterwards the appropriate place for inserting a node would be inside template's template contents.
+ // 10. Push template onto the stack of open elements so that it is the new current node.
+ // NB: This helper creates template (step 8) and pushes it (step 10) without inserting it into the DOM. It computes
+ // the target parent before creating template, and we compute insertionLocation (step 9) afterwards, below.
let template = self.insert_foreign_element_for(token, RustFfiHtmlNamespace::Html, true);
+ let template_node = self.stack_of_open_elements.pop().unwrap();
+ let insertion_location = self.appropriate_place_for_inserting_node(None);
+ self.stack_of_open_elements.push(template_node);
+
+ // 11. Let sanitizerAction be "Keep".
+ // 12. If the parser's parser sanitizer configuration is not null, then set sanitizerAction to the result of
+ // getting the sanitizer action for an element name given template's local name, template's namespace, and
+ // the parser's parser sanitizer configuration.
+ let sanitizer_action = self.sanitizer_action(template);
+
+ // 13. Switch on sanitizerAction:
+ match sanitizer_action {
+ // -> "Remove"
+ // -> "Replace with children"
+ // Return.
+ // NOTE: A template element has no children (its parsed contents are placed in its template contents
+ // DocumentFragment), so replacing it with its children has the same effect as removing it.
+ SanitizerAction::Remove | SanitizerAction::ReplaceWithChildren => return,
+ // -> "Keep"
+ SanitizerAction::Keep => {}
+ }
- // Let mode be template's shadowrootmode attribute's value.
- let mode = mode.unwrap();
+ // NB: The shadowroot* attributes are read from template, whose attributes were sanitized when it was created
+ // from the token.
+ let shadow_root_attributes = unsafe { ladybird_html_parser_declarative_shadow_root_attributes(template) };
- // Let slotAssignment be "named".
- let mut slot_assignment = RustFfiHtmlSlotAssignmentMode::Named;
+ // 1. If template's shadowrootmode attribute is not in the None state:
+ let mode = if shadow_root_attributes & SHADOW_ROOT_MODE_OPEN != 0 {
+ Some(RustFfiHtmlShadowRootMode::Open)
+ } else if shadow_root_attributes & SHADOW_ROOT_MODE_CLOSED != 0 {
+ Some(RustFfiHtmlShadowRootMode::Closed)
+ } else {
+ None
+ };
+ let Some(mode) = mode else {
+ // FIXME: 2. Otherwise, if template has a for attribute:
+ // 1. Let scope be the target parent of the adjusted insertion location given insertionLocation.
+ // 2. If scope is the body element of its node document, then set scope to its parent.
+ // 3. Let success be the result of preparing content patching given scope and template.
+ // 4. If success is false, then insert an element at the adjusted insertion location with template,
+ // insertionLocation, and true.
+ // 3. Otherwise, insert an element at the adjusted insertion location with template, insertionLocation, and
+ // true.
+ self.insert_element_at_adjusted_insertion_location(template, Some(insertion_location), true);
+ return;
+ };
- // If template's shadowrootslotassignment attribute is in the Manual state, then set slotAssignment to "manual".
- if token
- .attribute(attribute_name!("shadowrootslotassignment"))
- .is_some_and(|value| value.eq_ignore_ascii_case("manual"))
+ // 1. If any of the following are true:
+ // - the parser's allow declarative shadow roots is false;
+ // - hostIsRoot is true; or
+ // - the parser's insertion target redirection map[declarativeShadowHostElement] exists,
+ // then insert an element at the adjusted insertion location with template, insertionLocation, and true, and
+ // return.
+ // NOTE: The last condition applies when declarativeShadowHostElement is replaced with its children as part
+ // of sanitization. Since that element is never inserted, a shadow root attached to it would be lost.
+ // Instead, template is inserted as a regular template element, where the replaced element's children
+ // are inserted.
+ if !self.allow_declarative_shadow_roots
+ || host_is_root
+ || self
+ .insertion_target_redirection_map
+ .contains_key(&declarative_shadow_host_element)
{
- slot_assignment = RustFfiHtmlSlotAssignmentMode::Manual;
+ self.insert_element_at_adjusted_insertion_location(template, Some(insertion_location), true);
+ return;
}
- // Let clonable be true if template has a shadowrootclonable attribute; otherwise false.
- let clonable = token.has_attribute(attribute_name!("shadowrootclonable"));
+ // 2. Let mode be template's shadowrootmode attribute's value.
+ // 3. Let delegatesFocus be true if template has a shadowrootdelegatesfocus attribute; otherwise false.
+ let delegates_focus = shadow_root_attributes & SHADOW_ROOT_DELEGATES_FOCUS != 0;
- // Let serializable be true if template has a shadowrootserializable attribute; otherwise false.
- let serializable = token.has_attribute(attribute_name!("shadowrootserializable"));
+ // 4. Let serializable be true if template has a shadowrootserializable attribute; otherwise false.
+ let serializable = shadow_root_attributes & SHADOW_ROOT_SERIALIZABLE != 0;
- // Let delegatesFocus be true if template has a shadowrootdelegatesfocus attribute; otherwise false.
- // NB: The spec reads delegatesFocus, serializable, slotAssignment, then clonable; these independent reads are
- // currently grouped in the order of the host helper's initialization fields.
- let delegates_focus = token.has_attribute(attribute_name!("shadowrootdelegatesfocus"));
-
- // If declarativeShadowHostElement is a shadow host, then insert an element at the adjusted insertion location
- // with template, insertionLocation, and true.
- if self.is_shadow_host(declarative_shadow_host_element) {
- self.insert_element_at_adjusted_insertion_location(template, Some(adjusted_insertion_location));
- }
- // Otherwise:
- else {
- // 1. Let registry be null if template has a shadowrootcustomelementregistry attribute; otherwise
- // declarativeShadowHostElement's node document's custom element registry.
-
- // 2. Attach a shadow root with declarativeShadowHostElement, mode, delegatesFocus, serializable,
- // slotAssignment, clonable, and registry.
- let shadow_root = self.attach_declarative_shadow_root(DeclarativeShadowRootInit {
- host: declarative_shadow_host_element,
- mode,
- slot_assignment,
- clonable,
- serializable,
- delegates_focus,
- keep_custom_element_registry_null: token
- .has_attribute(attribute_name!("shadowrootcustomelementregistry")),
- });
+ // 5. Let slotAssignment be "named".
+ // 6. If template's shadowrootslotassignment attribute is in the Manual state, then set slotAssignment to
+ // "manual".
+ let slot_assignment = if shadow_root_attributes & SHADOW_ROOT_SLOT_ASSIGNMENT_MANUAL != 0 {
+ RustFfiHtmlSlotAssignmentMode::Manual
+ } else {
+ RustFfiHtmlSlotAssignmentMode::Named
+ };
- // If an exception is thrown, then catch it and:
- if shadow_root == 0 {
- // 1. Insert an element at the adjusted insertion location with template, insertionLocation, and true.
- self.insert_element_at_adjusted_insertion_location(template, Some(adjusted_insertion_location));
+ // 7. Let clonable be true if template has a shadowrootclonable attribute; otherwise false.
+ let clonable = shadow_root_attributes & SHADOW_ROOT_CLONABLE != 0;
- // 2. The user agent may report an error to the developer console.
+ // 8. If declarativeShadowHostElement is a shadow host, then insert an element at the adjusted insertion location
+ // with template, insertionLocation, and true.
+ if self.is_shadow_host(declarative_shadow_host_element) {
+ self.insert_element_at_adjusted_insertion_location(template, Some(insertion_location), true);
+ return;
+ }
+
+ // 9. Otherwise:
+ // 1. Let registry be null if template has a shadowrootcustomelementregistry attribute; otherwise
+ // declarativeShadowHostElement's node document's custom element registry.
+ // 2. Attach a shadow root with declarativeShadowHostElement, mode, delegatesFocus, serializable,
+ // slotAssignment, clonable, and registry.
+ let shadow_root = self.attach_declarative_shadow_root(DeclarativeShadowRootInit {
+ host: declarative_shadow_host_element,
+ mode,
+ slot_assignment,
+ clonable,
+ serializable,
+ delegates_focus,
+ keep_custom_element_registry_null: shadow_root_attributes & SHADOW_ROOT_CUSTOM_ELEMENT_REGISTRY != 0,
+ });
- // 3. Return.
- return;
- }
+ // If an exception is thrown, then catch it and:
+ if shadow_root == 0 {
+ // 1. Insert an element at the adjusted insertion location with template, insertionLocation, and true.
+ self.insert_element_at_adjusted_insertion_location(template, Some(insertion_location), true);
- // 3. Let shadow be declarativeShadowHostElement's shadow root.
+ // 2. The user agent may report an error to the developer console.
- // 4. Set shadow's available to element internals to true.
+ // 3. Return.
+ return;
+ }
- // 5. Set shadow's declarative to true.
- // NB: The C++ attachment helper performs steps 3 through 5.
+ // 3. Let shadow be declarativeShadowHostElement's shadow root.
+ // 4. Set shadow's available to element internals to true.
+ // 5. Set shadow's declarative to true.
+ // NB: The C++ attachment helper performs steps 3 through 5.
- // 6. Set template's template contents to shadow.
- self.set_template_content(template, shadow_root);
- self.stack_of_open_elements.last_mut().unwrap().template_content = Some(shadow_root);
+ // 6. Set template's template contents to shadow.
+ self.set_template_content(template, shadow_root);
+ self.stack_of_open_elements.last_mut().unwrap().template_content = Some(shadow_root);
- // 7. If template has a shadowrootcustomelementregistry attribute, then set shadow's keep custom element
- // registry null to true.
- // NB: The C++ attachment helper also sets this flag, using the value supplied from the original token.
- }
+ // 7. If template has a shadowrootcustomelementregistry attribute, then set shadow's keep custom element
+ // registry null to true.
+ // NB: The C++ attachment helper also sets this flag.
}
fn handle_template_end_tag(&mut self) {
@@ -3969,8 +4123,12 @@ impl TreeBuilder {
// https://html.spec.whatwg.org/multipage/parsing.html#insert-a-comment
fn insert_comment(&mut self, data: &str, insertion_location: Option<AdjustedInsertionLocation>) {
- // FIXME: 1. If the parser's parser sanitizer configuration is non-null and the parser's parser sanitizer
- // configuration does not allow comments, then return.
+ // 1. If the parser's parser sanitizer configuration is non-null and the parser's parser sanitizer configuration
+ // does not allow comments, then return.
+ if self.sanitizing && !self.sanitizer_allows_comments {
+ return;
+ }
+
// 2. Let data be the data given in the comment token being processed.
self.flush_character_insertions();
@@ -4037,6 +4195,7 @@ impl TreeBuilder {
let value = attribute.value.encode_utf16().collect::<Vec<_>>();
unsafe {
ladybird_html_parser_add_missing_attribute(
+ self.host,
element,
attribute.local_name.raw_identity(),
value.as_ptr(),
@@ -4454,11 +4613,25 @@ impl TreeBuilder {
// 3. If the parser's insertion target redirection map[targetParent] does not exist, then return location.
// 4. Assert: refChild is null.
// 5. Return the parser's insertion target redirection map[targetParent].
- // FIXME: Replace the root-only redirection with the insertion target redirection map, which also handles
- // elements replaced with children during sanitization.
+ if let Some(redirected_location) = self.insertion_target_redirection(adjusted_insertion_location.parent) {
+ return redirected_location;
+ }
self.apply_root_insertion_target(adjusted_insertion_location)
}
+ // https://html.spec.whatwg.org/multipage/parsing.html#adjusted-insertion-location
+ // NB: The adjusted insertion location given an insertion location, without recomputing the appropriate place for
+ // inserting a node from the location's parent.
+ fn adjusted_insertion_location_for_location(
+ &self,
+ location: AdjustedInsertionLocation,
+ ) -> AdjustedInsertionLocation {
+ if let Some(redirected_location) = self.insertion_target_redirection(location.parent) {
+ return redirected_location;
+ }
+ self.apply_root_insertion_target(location)
+ }
+
fn apply_root_insertion_target(
&self,
mut adjusted_insertion_location: AdjustedInsertionLocation,
@@ -4477,6 +4650,9 @@ impl TreeBuilder {
fn adjusted_insertion_location_for_text(&self) -> AdjustedInsertionLocation {
let insertion_location = self.appropriate_place_for_inserting_node(None);
+ if let Some(redirected_location) = self.insertion_target_redirection(insertion_location.parent) {
+ return redirected_location;
+ }
if self.root_insertion_target == 0 {
return insertion_location;
}
@@ -4696,21 +4872,35 @@ impl TreeBuilder {
let mut bookmark = formatting_index;
// 11. Let node and lastNode be furthestBlock.
+ // NB: A null lastNode is represented by 0.
let mut node_index = furthest_block_index;
let mut last_node = furthest_block.handle;
- // FIXME: 12. Let pendingRedirects be an empty list.
- // FIXME: 13. If the parser's parser sanitizer configuration is not null:
- // 1. Let action be the result of getting the sanitizer action for an element name given
- // lastNode's local name, lastNode's namespace, and the parser's parser sanitizer configuration.
- // 2. If action is not "Keep", then set lastNode to null.
- // 3. If action is "Replace with children", then append furthestBlock to pendingRedirects.
+ // 12. Let pendingRedirects be an empty list.
+ let mut pending_redirects: Vec<usize> = Vec::new();
+
+ // 13. If the parser's parser sanitizer configuration is not null:
+ if self.sanitizing {
+ // 1. Let action be the result of getting the sanitizer action for an element name given lastNode's local
+ // name, lastNode's namespace, and the parser's parser sanitizer configuration.
+ let action = self.sanitizer_action(last_node);
+
+ // 2. If action is not "Keep", then set lastNode to null.
+ if action != SanitizerAction::Keep {
+ last_node = 0;
+ }
+
+ // 3. If action is "Replace with children", then append furthestBlock to pendingRedirects.
+ if action == SanitizerAction::ReplaceWithChildren {
+ pending_redirects.push(furthest_block.handle);
+ }
+ }
// 14. Let innerLoopCounter be 0.
let mut inner_loop_counter: u8 = 0;
// 15. Let bookmarkMoved be false.
- // NB: Without sanitization, last_node == furthest_block.handle tracks whether the bookmark has moved.
+ let mut bookmark_moved = false;
// 16. While true:
loop {
@@ -4772,29 +4962,56 @@ impl TreeBuilder {
// 7. If bookmarkMoved is false, then move the aforementioned bookmark to be immediately after the new
// node in the list of active formatting elements, and set bookmarkMoved to true.
- if last_node == furthest_block.handle {
+ if !bookmark_moved {
bookmark = active_index + 1;
+ bookmark_moved = true;
}
// 8. Let nodeAction be "Keep".
- // FIXME: 9. If the parser's parser sanitizer configuration is not null, then set nodeAction to the result
- // of getting the sanitizer action for an element name given node's local name, node's namespace,
- // and the parser's parser sanitizer configuration.
- // FIXME: 10. If nodeAction is not "Replace with children":
- // 1. For each replacedElement of pendingRedirects: set the parser's insertion target
- // redirection map[replacedElement] to (node, null).
- // 2. Empty pendingRedirects.
+ // 9. If the parser's parser sanitizer configuration is not null, then set nodeAction to the result of
+ // getting the sanitizer action for an element name given node's local name, node's namespace, and the
+ // parser's parser sanitizer configuration.
+ let node_action = self.sanitizer_action(new_element);
+
+ // 10. If nodeAction is not "Replace with children":
+ if node_action != SanitizerAction::ReplaceWithChildren {
+ // 1. For each replacedElement of pendingRedirects: set the parser's insertion target redirection
+ // map[replacedElement] to (node, null).
+ // 2. Empty pendingRedirects.
+ for replaced_element in pending_redirects.drain(..) {
+ self.insertion_target_redirection_map.insert(
+ replaced_element,
+ RedirectedInsertionLocation {
+ parent: new_element,
+ reference_child: 0,
+ },
+ );
+ }
+ }
+
// 11. Switch on nodeAction:
- // -> "Keep"
- // If lastNode is non-null, then append lastNode to node. Set lastNode to node.
- // NB: The unsanitized path keeps lastNode non-null and always takes the "Keep" branch.
- self.append_child(new_element, last_node);
- last_node = new_element;
- // FIXME: -> "Remove"
- // If lastNode is non-null and lastNode's parent is non-null, then remove lastNode. Set lastNode
- // to null.
- // FIXME: -> "Replace with children"
- // Append node to pendingRedirects.
+ match node_action {
+ // -> "Keep"
+ // If lastNode is non-null, then append lastNode to node. Set lastNode to node.
+ SanitizerAction::Keep => {
+ if last_node != 0 {
+ self.append_child(new_element, last_node);
+ }
+ last_node = new_element;
+ }
+ // -> "Remove"
+ // If lastNode is non-null and lastNode's parent is non-null, then remove lastNode. Set lastNode
+ // to null.
+ SanitizerAction::Remove => {
+ if last_node != 0 && self.parent_node(last_node) != 0 {
+ unsafe { ladybird_html_parser_remove_node(last_node) };
+ }
+ last_node = 0;
+ }
+ // -> "Replace with children"
+ // Append node to pendingRedirects.
+ SanitizerAction::ReplaceWithChildren => pending_redirects.push(new_element),
+ }
}
// 17. Let insertionLocation be the appropriate place for inserting a node given commonAncestor.
@@ -4805,10 +5022,16 @@ impl TreeBuilder {
offset: APPEND_CHILD_OFFSET,
}));
- // FIXME: 19. For each replacedElement of pendingRedirects: set the parser's insertion target redirection
- // map[replacedElement] to (target, refNode).
- // NB: Steps 20 and 21 implemented on C++ side.
- self.reinsert_last_node_at_insertion_location(adjusted_insertion_location, last_node);
+ // 19. For each replacedElement of pendingRedirects: set the parser's insertion target redirection
+ // map[replacedElement] to (target, refNode).
+ for replaced_element in pending_redirects {
+ self.set_insertion_target_redirection(replaced_element, adjusted_insertion_location);
+ }
+
+ // NB: Steps 20 and 21 implemented on C++ side. Both steps do nothing if lastNode is null.
+ if last_node != 0 {
+ self.reinsert_last_node_at_insertion_location(adjusted_insertion_location, last_node);
+ }
// 22. Let newElement be the result of creating an element for the token for which formattingElement was
// created, in the HTML namespace, with furthestBlock as the intended parent.
@@ -4824,24 +5047,45 @@ impl TreeBuilder {
// FIXME: Perform steps 23 and 24 before the child mutations in step 27.
// 25. Let sanitizerAction be "Keep".
- // FIXME: 26. If the parser's parser sanitizer configuration is not null, then set sanitizerAction to the result
- // of getting the sanitizer action for an element name given newElement's local name,
- // newElement's namespace, and the parser's parser sanitizer configuration.
- // 27. Switch on sanitizerAction:
- // FIXME: -> "Replace with children"
- // Set the parser's insertion target redirection map[newElement] to the adjusted insertion location
- // given (furthestBlock, null).
- // FIXME: -> "Remove"
- // Take all of the child nodes of furthestBlock and append them to newElement.
- // -> "Keep"
- // 1. Take all of the child nodes of furthestBlock and append them to newElement.
- self.move_all_children(furthest_block.handle, new_element);
+ // 26. If the parser's parser sanitizer configuration is not null, then set sanitizerAction to the result of
+ // getting the sanitizer action for an element name given newElement's local name, newElement's
+ // namespace, and the parser's parser sanitizer configuration.
+ let sanitizer_action = self.sanitizer_action(new_element);
- // FIXME: 2. Let (newElementParent, newElementRefNode) be the adjusted insertion location given
- // (furthestBlock, null).
- // 3. Insert newElement into newElementParent before newElementRefNode.
- // NB: The current unsanitized path appends directly to furthestBlock.
- self.append_child(furthest_block.handle, new_element);
+ // 27. Switch on sanitizerAction:
+ let furthest_block_location = AdjustedInsertionLocation {
+ parent: furthest_block.handle,
+ offset: APPEND_CHILD_OFFSET,
+ };
+ match sanitizer_action {
+ // -> "Replace with children"
+ // Set the parser's insertion target redirection map[newElement] to the adjusted insertion location
+ // given (furthestBlock, null).
+ SanitizerAction::ReplaceWithChildren => {
+ let location = self.adjusted_insertion_location_for_location(furthest_block_location);
+ self.set_insertion_target_redirection(new_element, location);
+ }
+ // -> "Remove"
+ // Take all of the child nodes of furthestBlock and append them to newElement.
+ SanitizerAction::Remove => self.move_all_children(furthest_block.handle, new_element),
+ // -> "Keep"
+ SanitizerAction::Keep => {
+ // 1. Take all of the child nodes of furthestBlock and append them to newElement.
+ self.move_all_children(furthest_block.handle, new_element);
+
+ // 2. Let (newElementParent, newElementRefNode) be the adjusted insertion location given
+ // (furthestBlock, null).
+ // 3. Insert newElement into newElementParent before newElementRefNode.
+ // NB: Without sanitization, the adjusted insertion location given (furthestBlock, null) is
+ // (furthestBlock, null).
+ if self.sanitizing {
+ let location = self.adjusted_insertion_location_for_location(furthest_block_location);
+ self.insert_node_at_insertion_location(location, new_element);
+ } else {
+ self.append_child(furthest_block.handle, new_element);
+ }
+ }
+ }
// 23. Remove formattingElement from the list of active formatting elements, and insert newElement into the
// list of active formatting elements at the position of the aforementioned bookmark.
@@ -4887,13 +5131,33 @@ impl TreeBuilder {
template_content: None,
},
);
- // FIXME: 28. Let belowNode be the element immediately below newElement in the stack of open elements, if any;
- // otherwise null.
- // FIXME: 29. While belowNode is non-null and the parser's insertion target redirection map[belowNode] exists:
- // 1. Set the parser's insertion target redirection map[belowNode] to the adjusted insertion location
- // given (newElement, null).
- // 2. Set belowNode to the element immediately below belowNode in the stack of open elements, if any;
- // otherwise null.
+ // 28. Let belowNode be the element immediately below newElement in the stack of open elements, if any;
+ // otherwise null.
+ // 29. While belowNode is non-null and the parser's insertion target redirection map[belowNode] exists:
+ // 1. Set the parser's insertion target redirection map[belowNode] to the adjusted insertion location
+ // given (newElement, null).
+ // 2. Set belowNode to the element immediately below belowNode in the stack of open elements, if any;
+ // otherwise null.
+ // NOTE: Elements below furthestBlock in the stack that were replaced with their children now have
+ // newElement between them and furthestBlock. They are usually popped before anything else is
+ // inserted, but if the outer loop reaches its limit they remain on the stack, so their entries are
+ // updated here.
+ if !self.insertion_target_redirection_map.is_empty() {
+ let new_element_location = AdjustedInsertionLocation {
+ parent: new_element,
+ offset: APPEND_CHILD_OFFSET,
+ };
+ let mut below_node_index = furthest_block_stack_index + 2;
+ while below_node_index < self.stack_of_open_elements.len() {
+ let below_node = self.stack_of_open_elements[below_node_index].handle;
+ if !self.insertion_target_redirection_map.contains_key(&below_node) {
+ break;
+ }
+ let location = self.adjusted_insertion_location_for_location(new_element_location);
+ self.set_insertion_target_redirection(below_node, location);
+ below_node_index += 1;
+ }
+ }
}
}
@@ -5791,6 +6055,22 @@ pub unsafe extern "C" fn rust_html_parser_begin_fragment(
});
}
+/// Record that the parser's parser sanitizer configuration is non-null, and whether it allows comments.
+///
+/// This must be called after `rust_html_parser_begin_fragment`, which resets the parser state.
+#[unsafe(no_mangle)]
+pub extern "C" fn rust_html_parser_set_sanitizer(
+ handle: Option<&mut RustFfiHtmlParserHandle>,
+ sanitizing: bool,
+ allows_comments: bool,
+) {
+ let Some(handle) = handle else {
+ return;
+ };
+ handle.state.sanitizing = sanitizing;
+ handle.state.sanitizer_allows_comments = allows_comments;
+}
+
/// Run the Rust HTML parser.
///
/// Returns `ExecuteScript` when tree construction reaches a parser-blocking script
diff --git a/Libraries/LibWeb/HTML/Sanitizer.cpp b/Libraries/LibWeb/HTML/Sanitizer.cpp
new file mode 100644
index 00000000000..396963f724c
--- /dev/null
+++ b/Libraries/LibWeb/HTML/Sanitizer.cpp
@@ -0,0 +1,590 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/QuickSort.h>
+#include <LibGC/Heap.h>
+#include <LibWeb/Bindings/Sanitizer.h>
+#include <LibWeb/HTML/Sanitizer.h>
+
+namespace Web::HTML {
+
+GC_DEFINE_ALLOCATOR(Sanitizer);
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-constructor
+WebIDL::ExceptionOr<GC::Ref<Sanitizer>> Sanitizer::create(Variant<Bindings::SanitizerConfig, Bindings::SanitizerPresets> const& configuration)
+{
+ // 1. If configuration is a SanitizerPresets string:
+ // 1. Assert: configuration is "default".
+ // 2. Set configuration to the built-in safe default configuration.
+ auto fresh_configuration = configuration.visit(
+ [](Bindings::SanitizerConfig const& config) { return canonicalize_sanitizer_config(config); },
+ [](Bindings::SanitizerPresets preset) {
+ VERIFY(preset == Bindings::SanitizerPresets::Default);
+ return built_in_safe_default_configuration();
+ });
+
+ // 2. Configure this given configuration and true.
+ auto canonical_configuration = TRY(configure_sanitizer_configuration(move(fresh_configuration), PermissiveDefaults::Yes));
+ return create_with_configuration(move(canonical_configuration));
+}
+
+GC::Ref<Sanitizer> Sanitizer::create_with_configuration(SanitizerConfiguration configuration)
+{
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+ return GC::Heap::the().allocate<Sanitizer>(move(configuration));
+}
+
+Sanitizer::Sanitizer(SanitizerConfiguration configuration)
+ : m_configuration(move(configuration))
+{
+}
+
+Sanitizer::~Sanitizer() = default;
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#compare-sanitizer-items
+static bool compare_sanitizer_items(SanitizerName const& item_a, SanitizerName const& item_b)
+{
+ // 1. Let namespaceA be itemA["namespace"].
+ auto const& namespace_a = item_a.namespace_;
+
+ // 2. Let namespaceB be itemB["namespace"].
+ auto const& namespace_b = item_b.namespace_;
+
+ // 3. If namespaceA is null:
+ if (!namespace_a.has_value()) {
+ // 1. If namespaceB is not null, then return true.
+ if (namespace_b.has_value())
+ return true;
+ }
+ // 4. Otherwise:
+ else {
+ // 1. If namespaceB is null, then return false.
+ if (!namespace_b.has_value())
+ return false;
+
+ // 2. If namespaceA is code unit less than namespaceB, then return true.
+ if (namespace_a->view().is_code_unit_less_than(namespace_b->view()))
+ return true;
+
+ // 3. If namespaceA is not namespaceB, then return false.
+ if (*namespace_a != *namespace_b)
+ return false;
+ }
+
+ // 5. If itemA["name"] is code unit less than itemB["name"], then return true.
+ if (item_a.name.view().is_code_unit_less_than(item_b.name.view()))
+ return true;
+
+ // 6. Return false.
+ return false;
+}
+
+static void sort_sanitizer_items(Vector<SanitizerName>& list)
+{
+ quick_sort(list, compare_sanitizer_items);
+}
+
+static void sort_processing_instructions(Vector<Utf16String>& list)
+{
+ quick_sort(list, [](auto const& pi_a, auto const& pi_b) { return pi_a.utf16_view().is_code_unit_less_than(pi_b.utf16_view()); });
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-get
+Bindings::SanitizerConfig Sanitizer::get() const
+{
+ // NOTE: Outside of the get() method, the order of the Sanitizer's elements and attributes is unobservable. By
+ // explicitly sorting the result of this method, we give implementations the opportunity to optimize by,
+ // for example, using unordered sets internally.
+
+ // 1. Let config be this's configuration.
+ auto config = m_configuration;
+
+ // 2. Assert: config is valid.
+ VERIFY(sanitizer_configuration_is_valid(config));
+
+ // 3. If config["elements"] exists:
+ if (config.elements.has_value()) {
+ // 1. For each element of config["elements"]:
+ for (auto& element : *config.elements) {
+ // 1. If element["attributes"] exists, then set element["attributes"] to the result of sorting
+ // element["attributes"], with compare sanitizer items.
+ if (element.attributes.has_value())
+ sort_sanitizer_items(*element.attributes);
+
+ // 2. If element["removeAttributes"] exists, then set element["removeAttributes"] to the result of sorting
+ // element["removeAttributes"], with compare sanitizer items.
+ if (element.remove_attributes.has_value())
+ sort_sanitizer_items(*element.remove_attributes);
+ }
+
+ // 2. Set config["elements"] to the result of sorting config["elements"], with compare sanitizer items.
+ quick_sort(*config.elements, [](auto const& a, auto const& b) { return compare_sanitizer_items(a.element, b.element); });
+ }
+ // 4. Otherwise:
+ else {
+ // 1. Set config["removeElements"] to the result of sorting config["removeElements"], with compare sanitizer
+ // items.
+ sort_sanitizer_items(*config.remove_elements);
+ }
+
+ // 5. If config["replaceWithChildrenElements"] exists, then set config["replaceWithChildrenElements"] to the result
+ // of sorting config["replaceWithChildrenElements"], with compare sanitizer items.
+ if (config.replace_with_children_elements.has_value())
+ sort_sanitizer_items(*config.replace_with_children_elements);
+
+ // 6. If config["processingInstructions"] exists, then set config["processingInstructions"] to the result of
+ // sorting config["processingInstructions"], with piA["target"] being code unit less than piB["target"].
+ if (config.processing_instructions.has_value())
+ sort_processing_instructions(*config.processing_instructions);
+ // 7. Otherwise:
+ else {
+ // 1. Set config["removeProcessingInstructions"] to the result of sorting
+ // config["removeProcessingInstructions"], with piA["target"] being code unit less than piB["target"].
+ sort_processing_instructions(*config.remove_processing_instructions);
+ }
+
+ // 8. If config["attributes"] exists, then set config["attributes"] to the result of sorting config["attributes"]
+ // given compare sanitizer items.
+ if (config.attributes.has_value())
+ sort_sanitizer_items(*config.attributes);
+ // 9. Otherwise:
+ else {
+ // 1. Set config["removeAttributes"] to the result of sorting config["removeAttributes"] given compare
+ // sanitizer items.
+ sort_sanitizer_items(*config.remove_attributes);
+ }
+
+ // 10. Return config.
+ return sanitizer_configuration_to_bindings(config);
+}
+
+// https://infra.spec.whatwg.org/#create-a-set
+static Vector<SanitizerName> create_a_set(Vector<SanitizerName> const& list)
+{
+ Vector<SanitizerName> set;
+ for (auto const& item : list) {
+ if (!sanitizer_list_contains(set, item))
+ set.append(item);
+ }
+ return set;
+}
+
+// https://infra.spec.whatwg.org/#set-difference
+static Vector<SanitizerName> difference(Vector<SanitizerName> const& a, Vector<SanitizerName> const& b)
+{
+ Vector<SanitizerName> result;
+ for (auto const& item : a) {
+ if (!sanitizer_list_contains(b, item))
+ result.append(item);
+ }
+ return result;
+}
+
+// https://infra.spec.whatwg.org/#set-intersection
+static Vector<SanitizerName> intersection(Vector<SanitizerName> const& a, Vector<SanitizerName> const& b)
+{
+ Vector<SanitizerName> result;
+ for (auto const& item : a) {
+ if (sanitizer_list_contains(b, item))
+ result.append(item);
+ }
+ return result;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-allowelement
+bool Sanitizer::allow_element(Variant<Utf16String, Bindings::SanitizerElementNamespaceWithAttributes> const& element_input)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. Set element to the result of canonicalizing element.
+ auto element = canonicalize_sanitizer_element_with_attributes(element_input);
+
+ // 4. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. Let modified be the result of removing element from configuration["replaceWithChildrenElements"].
+ bool modified = sanitizer_list_remove(configuration.replace_with_children_elements, element.element);
+
+ // 2. If configuration["attributes"] exists:
+ if (configuration.attributes.has_value()) {
+ // 1. If element["attributes"] exists:
+ if (element.attributes.has_value()) {
+ // 1. Set element["attributes"] to the result of creating a set from element["attributes"].
+ element.attributes = create_a_set(*element.attributes);
+
+ // 2. Set element["attributes"] to the difference of element["attributes"] and
+ // configuration["attributes"].
+ element.attributes = difference(*element.attributes, *configuration.attributes);
+
+ // 3. If configuration["dataAttributes"] is true, then remove all items item from element["attributes"]
+ // where item is a custom data attribute.
+ if (configuration.data_attributes == true)
+ element.attributes->remove_all_matching([](auto const& item) { return is_custom_data_attribute(item); });
+ }
+
+ // 2. If element["removeAttributes"] exists:
+ if (element.remove_attributes.has_value()) {
+ // 1. Set element["removeAttributes"] to the result of creating a set from element["removeAttributes"].
+ element.remove_attributes = create_a_set(*element.remove_attributes);
+
+ // 2. Set element["removeAttributes"] to the intersection of element["removeAttributes"] and
+ // configuration["attributes"].
+ element.remove_attributes = intersection(*element.remove_attributes, *configuration.attributes);
+ }
+ }
+ // 3. Otherwise:
+ else {
+ // 1. If element["attributes"] exists:
+ if (element.attributes.has_value()) {
+ // 1. Set element["attributes"] to the result of creating a set from element["attributes"].
+ element.attributes = create_a_set(*element.attributes);
+
+ // 2. Set element["attributes"] to the difference of element["attributes"] and
+ // element["removeAttributes"] with default « ».
+ element.attributes = difference(*element.attributes, element.remove_attributes.value_or({}));
+
+ // 3. Remove element["removeAttributes"].
+ element.remove_attributes = {};
+
+ // 4. Set element["attributes"] to the difference of element["attributes"] and
+ // configuration["removeAttributes"].
+ element.attributes = difference(*element.attributes, *configuration.remove_attributes);
+ }
+
+ // 2. If element["removeAttributes"] exists:
+ if (element.remove_attributes.has_value()) {
+ // 1. Set element["removeAttributes"] to the result of creating a set from element["removeAttributes"].
+ element.remove_attributes = create_a_set(*element.remove_attributes);
+
+ // 2. Set element["removeAttributes"] to the difference of element["removeAttributes"] and
+ // configuration["removeAttributes"].
+ element.remove_attributes = difference(*element.remove_attributes, *configuration.remove_attributes);
+ }
+ }
+
+ // 4. If configuration["elements"] does not contain element:
+ auto current_element = configuration.elements->find_if([&](auto const& item) { return item.element == element.element; });
+ if (current_element.is_end()) {
+ // 1. Append element to configuration["elements"].
+ configuration.elements->append(move(element));
+
+ // 2. Return true.
+ return true;
+ }
+
+ // 5. Let currentElement be the item in configuration["elements"] whose name member is element's name member
+ // and whose namespace member is element's namespace member.
+ // 6. If element is equal to currentElement, then return modified.
+ if (element == *current_element)
+ return modified;
+
+ // 7. Remove element from configuration["elements"].
+ configuration.elements->remove(current_element.index());
+
+ // 8. Append element to configuration["elements"].
+ configuration.elements->append(move(element));
+
+ // 9. Return true.
+ return true;
+ }
+
+ // 5. Otherwise:
+ // 1. If element["attributes"] exists or element["removeAttributes"] with default « » is not empty, then return
+ // false.
+ if (element.attributes.has_value() || (element.remove_attributes.has_value() && !element.remove_attributes->is_empty()))
+ return false;
+
+ // 2. Let modified be the result of removing element from configuration["replaceWithChildrenElements"].
+ bool modified = sanitizer_list_remove(configuration.replace_with_children_elements, element.element);
+
+ // 3. If configuration["removeElements"] does not contain element, then return modified.
+ if (!sanitizer_list_contains(*configuration.remove_elements, element.element))
+ return modified;
+
+ // 4. Remove element from configuration["removeElements"].
+ sanitizer_list_remove(configuration.remove_elements, element.element);
+
+ // 5. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-removeelement
+bool Sanitizer::remove_element(Variant<Utf16String, Bindings::SanitizerElementNamespace> const& element)
+{
+ // The removeElement(element) method steps are to return the result of removing element from this's
+ // configuration.
+ return remove_an_element_from_sanitizer_config(m_configuration, canonicalize_sanitizer_element(element));
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-replaceelementwithchildren
+bool Sanitizer::replace_element_with_children(Variant<Utf16String, Bindings::SanitizerElementNamespace> const& element_input)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. Set element to the result of canonicalizing element.
+ auto element = canonicalize_sanitizer_element(element_input);
+
+ // 4. If the built-in non-replaceable elements list contains element, then return false.
+ if (built_in_non_replaceable_elements_list_contains(element))
+ return false;
+
+ // 5. Let modified be the result of removing element from configuration["elements"].
+ bool modified = false;
+ if (configuration.elements.has_value())
+ modified = configuration.elements->remove_all_matching([&](auto const& item) { return item.element == element; });
+
+ // 6. If removing element from configuration["removeElements"] is true, then set modified to true.
+ if (sanitizer_list_remove(configuration.remove_elements, element))
+ modified = true;
+
+ // 7. If configuration["replaceWithChildrenElements"] does not contain element:
+ if (!configuration.replace_with_children_elements.has_value() || !sanitizer_list_contains(*configuration.replace_with_children_elements, element)) {
+ // 1. Append element to configuration["replaceWithChildrenElements"].
+ if (!configuration.replace_with_children_elements.has_value())
+ configuration.replace_with_children_elements = Vector<SanitizerName> {};
+ configuration.replace_with_children_elements->append(element);
+
+ // 2. Return true.
+ return true;
+ }
+
+ // 8. Return modified.
+ return modified;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-allowattribute
+bool Sanitizer::allow_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const& attribute_input)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. Set attribute to the result of canonicalizing attribute.
+ auto attribute = canonicalize_sanitizer_attribute(attribute_input);
+
+ // 4. If configuration["attributes"] exists:
+ if (configuration.attributes.has_value()) {
+ // 1. If configuration["dataAttributes"] is true and attribute is a custom data attribute, then return false.
+ if (configuration.data_attributes == true && is_custom_data_attribute(attribute))
+ return false;
+
+ // 2. If configuration["attributes"] contains attribute, then return false.
+ if (sanitizer_list_contains(*configuration.attributes, attribute))
+ return false;
+
+ // 3. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. For each element in configuration["elements"]:
+ for (auto& element : *configuration.elements) {
+ // 1. If element["attributes"] with default « » contains attribute, then remove attribute from
+ // element["attributes"].
+ sanitizer_list_remove(element.attributes, attribute);
+ }
+ }
+
+ // 4. Append attribute to configuration["attributes"].
+ configuration.attributes->append(attribute);
+
+ // 5. Return true.
+ return true;
+ }
+
+ // 5. Otherwise:
+ // 1. If configuration["removeAttributes"] does not contain attribute, then return false.
+ if (!sanitizer_list_contains(*configuration.remove_attributes, attribute))
+ return false;
+
+ // 2. Remove attribute from configuration["removeAttributes"].
+ sanitizer_list_remove(configuration.remove_attributes, attribute);
+
+ // 3. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-removeattribute
+bool Sanitizer::remove_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const& attribute)
+{
+ // The removeAttribute(attribute) method steps are to return the result of removing attribute from this's
+ // configuration.
+ return remove_an_attribute_from_sanitizer_config(m_configuration, canonicalize_sanitizer_attribute(attribute));
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-setcomments
+bool Sanitizer::set_comments(bool allow)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. If configuration["comments"] is allow, then return false.
+ if (configuration.comments == allow)
+ return false;
+
+ // 4. Set configuration["comments"] to allow.
+ configuration.comments = allow;
+
+ // 5. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-setdataattributes
+bool Sanitizer::set_data_attributes(bool allow)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. If configuration["attributes"] does not exist, then return false.
+ if (!configuration.attributes.has_value())
+ return false;
+
+ // 4. If configuration["dataAttributes"] exists and is equal to allow, then return false.
+ if (configuration.data_attributes == allow)
+ return false;
+
+ // 5. If allow is true:
+ if (allow) {
+ // 1. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. For each element of configuration["elements"]:
+ for (auto& element : *configuration.elements) {
+ // 1. If element["attributes"] exists, then remove all items item from element["attributes"] where item
+ // is a custom data attribute.
+ if (element.attributes.has_value())
+ element.attributes->remove_all_matching([](auto const& item) { return is_custom_data_attribute(item); });
+ }
+ }
+
+ // 2. Remove all items item from configuration["attributes"] where item is a custom data attribute.
+ configuration.attributes->remove_all_matching([](auto const& item) { return is_custom_data_attribute(item); });
+ }
+
+ // 6. Set configuration["dataAttributes"] to allow.
+ configuration.data_attributes = allow;
+
+ // 7. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-setjavascripturls
+bool Sanitizer::set_javascript_urls(bool allow)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. If configuration["javascriptURLs"] is allow, then return false.
+ if (configuration.javascript_urls == allow)
+ return false;
+
+ // 4. Set configuration["javascriptURLs"] to allow.
+ configuration.javascript_urls = allow;
+
+ // 5. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-allowprocessinginstruction
+bool Sanitizer::allow_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const& pi_input)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. Set pi to the result of canonicalizing pi.
+ auto pi = canonicalize_sanitizer_processing_instruction(pi_input);
+
+ // 4. If configuration["processingInstructions"] exists:
+ if (configuration.processing_instructions.has_value()) {
+ // 1. If configuration["processingInstructions"] contains pi, then return false.
+ if (configuration.processing_instructions->contains_slow(pi))
+ return false;
+
+ // 2. Append pi to configuration["processingInstructions"].
+ configuration.processing_instructions->append(move(pi));
+
+ // 3. Return true.
+ return true;
+ }
+
+ // 5. Otherwise:
+ // 1. If configuration["removeProcessingInstructions"] contains pi:
+ if (configuration.remove_processing_instructions->contains_slow(pi)) {
+ // 1. Remove pi from configuration["removeProcessingInstructions"].
+ configuration.remove_processing_instructions->remove_all_matching([&](auto const& item) { return item == pi; });
+
+ // 2. Return true.
+ return true;
+ }
+
+ // 2. Return false.
+ return false;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-removeprocessinginstruction
+bool Sanitizer::remove_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const& pi_input)
+{
+ // 1. Let configuration be this's configuration.
+ auto& configuration = m_configuration;
+
+ // 2. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 3. Set pi to the result of canonicalizing pi.
+ auto pi = canonicalize_sanitizer_processing_instruction(pi_input);
+
+ // 4. If configuration["processingInstructions"] exists:
+ if (configuration.processing_instructions.has_value()) {
+ // 1. If configuration["processingInstructions"] contains pi:
+ if (configuration.processing_instructions->contains_slow(pi)) {
+ // 1. Remove pi from configuration["processingInstructions"].
+ configuration.processing_instructions->remove_all_matching([&](auto const& item) { return item == pi; });
+
+ // 2. Return true.
+ return true;
+ }
+
+ // 2. Return false.
+ return false;
+ }
+
+ // 5. Otherwise:
+ // 1. If configuration["removeProcessingInstructions"] contains pi, then return false.
+ if (configuration.remove_processing_instructions->contains_slow(pi))
+ return false;
+
+ // 2. Append pi to configuration["removeProcessingInstructions"].
+ configuration.remove_processing_instructions->append(move(pi));
+
+ // 3. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizer-removeunsafe
+bool Sanitizer::remove_unsafe()
+{
+ // The removeUnsafe() method steps are to return the result of removing unsafe from this's configuration.
+ return remove_unsafe_from_sanitizer_config(m_configuration);
+}
+
+}
diff --git a/Libraries/LibWeb/HTML/Sanitizer.h b/Libraries/LibWeb/HTML/Sanitizer.h
new file mode 100644
index 00000000000..94b0b8e7c86
--- /dev/null
+++ b/Libraries/LibWeb/HTML/Sanitizer.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
+
+namespace Web::Bindings {
+
+enum class SanitizerPresets : u8;
+struct SanitizerElementNamespace;
+struct SanitizerElementNamespaceWithAttributes;
+struct SanitizerAttributeNamespace;
+struct SanitizerProcessingInstruction;
+
+}
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer
+class Sanitizer final : public Bindings::GCAllocatedWrappable {
+ WEB_WRAPPABLE(Sanitizer, Bindings::GCAllocatedWrappable);
+ GC_DECLARE_ALLOCATOR(Sanitizer);
+
+public:
+ static WebIDL::ExceptionOr<GC::Ref<Sanitizer>> create(Variant<Bindings::SanitizerConfig, Bindings::SanitizerPresets> const& configuration);
+ static GC::Ref<Sanitizer> create_with_configuration(SanitizerConfiguration);
+
+ virtual ~Sanitizer() override;
+
+ Bindings::SanitizerConfig get() const;
+
+ bool allow_element(Variant<Utf16String, Bindings::SanitizerElementNamespaceWithAttributes> const&);
+ bool remove_element(Variant<Utf16String, Bindings::SanitizerElementNamespace> const&);
+ bool replace_element_with_children(Variant<Utf16String, Bindings::SanitizerElementNamespace> const&);
+ bool allow_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const&);
+ bool remove_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const&);
+ bool allow_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const&);
+ bool remove_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const&);
+ bool set_comments(bool allow);
+ bool set_data_attributes(bool allow);
+ bool set_javascript_urls(bool allow);
+ bool remove_unsafe();
+
+ SanitizerConfiguration const& configuration() const { return m_configuration; }
+
+private:
+ explicit Sanitizer(SanitizerConfiguration);
+
+ // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-configuration
+ SanitizerConfiguration m_configuration;
+};
+
+}
diff --git a/Libraries/LibWeb/HTML/Sanitizer.idl b/Libraries/LibWeb/HTML/Sanitizer.idl
new file mode 100644
index 00000000000..f5df3561288
--- /dev/null
+++ b/Libraries/LibWeb/HTML/Sanitizer.idl
@@ -0,0 +1,85 @@
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerpresets
+enum SanitizerPresets { "default" };
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sethtmloptions
+dictionary SetHTMLOptions {
+ (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer = "default";
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sethtmlunsafeoptions
+dictionary SetHTMLUnsafeOptions {
+ (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer;
+ boolean runScripts = false;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#parsehtmlunsafeoptions
+dictionary ParseHTMLUnsafeOptions {
+ (Sanitizer or SanitizerConfig or SanitizerPresets) sanitizer;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer
+[Exposed=Window]
+interface Sanitizer {
+ constructor(optional (SanitizerConfig or SanitizerPresets) configuration = "default");
+
+ // Query configuration:
+ SanitizerConfig get();
+
+ // Modify a Sanitizer's lists and fields:
+ boolean allowElement(SanitizerElementWithAttributes element);
+ boolean removeElement(SanitizerElement element);
+ boolean replaceElementWithChildren(SanitizerElement element);
+ boolean allowProcessingInstruction(SanitizerPI pi);
+ boolean removeProcessingInstruction(SanitizerPI pi);
+ boolean allowAttribute(SanitizerAttribute attribute);
+ boolean removeAttribute(SanitizerAttribute attribute);
+ boolean setComments(boolean allow);
+ boolean setDataAttributes(boolean allow);
+ [ImplementedAs=set_javascript_urls] boolean setJavascriptURLs(boolean allow);
+
+ // Remove markup that executes script.
+ boolean removeUnsafe();
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerelementnamespace
+dictionary SanitizerElementNamespace {
+ required DOMString name;
+ DOMString? _namespace = "http://www.w3.org/1999/xhtml";
+};
+
+// Used by "elements"
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerelementnamespacewithattributes
+dictionary SanitizerElementNamespaceWithAttributes : SanitizerElementNamespace {
+ sequence<SanitizerAttribute> attributes;
+ sequence<SanitizerAttribute> removeAttributes;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerattributenamespace
+dictionary SanitizerAttributeNamespace {
+ required DOMString name;
+ DOMString? _namespace = null;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerprocessinginstruction
+dictionary SanitizerProcessingInstruction {
+ required DOMString target;
+};
+
+typedef (DOMString or SanitizerElementNamespace) SanitizerElement;
+typedef (DOMString or SanitizerElementNamespaceWithAttributes) SanitizerElementWithAttributes;
+typedef (DOMString or SanitizerProcessingInstruction) SanitizerPI;
+typedef (DOMString or SanitizerAttributeNamespace) SanitizerAttribute;
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizerconfig
+dictionary SanitizerConfig {
+ sequence<SanitizerElementWithAttributes> elements;
+ sequence<SanitizerElement> removeElements;
+ sequence<SanitizerElement> replaceWithChildrenElements;
+ sequence<SanitizerPI> processingInstructions;
+ sequence<SanitizerPI> removeProcessingInstructions;
+ sequence<SanitizerAttribute> attributes;
+ sequence<SanitizerAttribute> removeAttributes;
+ boolean comments;
+ boolean dataAttributes;
+ boolean javascriptURLs;
+};
diff --git a/Libraries/LibWeb/HTML/SanitizerConfiguration.cpp b/Libraries/LibWeb/HTML/SanitizerConfiguration.cpp
new file mode 100644
index 00000000000..30b2857fff5
--- /dev/null
+++ b/Libraries/LibWeb/HTML/SanitizerConfiguration.cpp
@@ -0,0 +1,1381 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/NeverDestroyed.h>
+#include <AK/QuickSort.h>
+#include <LibURL/Parser.h>
+#include <LibWeb/Bindings/Sanitizer.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/HTML/AttributeNames.h>
+#include <LibWeb/HTML/GlobalEventHandlers.h>
+#include <LibWeb/HTML/Sanitizer.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
+#include <LibWeb/HTML/TagNames.h>
+#include <LibWeb/HTML/WindowEventHandlers.h>
+#include <LibWeb/Namespace.h>
+#include <LibWeb/TrustedTypes/TrustedHTMLParserOptions.h>
+
+namespace Web::HTML {
+
+template<typename T>
+static constexpr bool is_string_type = IsSame<RemoveCVReference<T>, Utf16String>;
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-sanitizer-name
+template<typename Name>
+static SanitizerName canonicalize_a_sanitizer_name(Name const& name, Optional<Utf16FlyString> const& default_namespace)
+{
+ return name.visit(
+ [&](Utf16String const& string) {
+ // 1. If name is a DOMString, then return «[ "name" → name, "namespace" → defaultNamespace ]».
+ return SanitizerName { Utf16FlyString { string }, default_namespace };
+ },
+ [&](auto const& dictionary) {
+ // 2. Assert: name is a dictionary and both name["name"] and name["namespace"] exist.
+ Optional<Utf16FlyString> namespace_;
+ if (dictionary.namespace_.has_value())
+ namespace_ = Utf16FlyString { *dictionary.namespace_ };
+
+ // 3. If name["namespace"] is the empty string, then set it to null.
+ if (namespace_.has_value() && namespace_->is_empty())
+ namespace_ = {};
+
+ // 4. Return «[ "name" → name["name"], "namespace" → name["namespace"] ]».
+ return SanitizerName { Utf16FlyString { dictionary.name }, move(namespace_) };
+ });
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-sanitizer-element
+template<typename Element>
+static SanitizerName canonicalize_a_sanitizer_element(Element const& element)
+{
+ // Return the result of canonicalizing element with the HTML namespace as the default namespace.
+ return canonicalize_a_sanitizer_name(element, Namespace::HTML);
+}
+
+// NB: Attributes are canonicalized with the default namespace of null.
+template<typename Attribute>
+static SanitizerName canonicalize_a_sanitizer_attribute(Attribute const& attribute)
+{
+ return canonicalize_a_sanitizer_name(attribute, OptionalNone {});
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-sanitizer-element-list
+template<typename List>
+static Vector<SanitizerName> canonicalize_a_sanitizer_element_list(List const& list)
+{
+ // 1. Let newList be « ».
+ Vector<SanitizerName> new_list;
+ new_list.ensure_capacity(list.size());
+
+ // 2. For each item in list, append the result of canonicalizing item to newList.
+ for (auto const& item : list)
+ new_list.unchecked_append(canonicalize_a_sanitizer_element(item));
+
+ // 3. Return newList.
+ return new_list;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-sanitizer-list
+template<typename List>
+static Vector<SanitizerName> canonicalize_a_sanitizer_list(List const& list)
+{
+ // 1. Let newList be « ».
+ Vector<SanitizerName> new_list;
+ new_list.ensure_capacity(list.size());
+
+ // 2. For each item in list, append the result of canonicalizing item to newList.
+ for (auto const& item : list)
+ new_list.unchecked_append(canonicalize_a_sanitizer_attribute(item));
+
+ // 3. Return newList.
+ return new_list;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-processing-instruction-list
+template<typename List>
+static Vector<Utf16String> canonicalize_a_processing_instruction_list(List const& list)
+{
+ // 1. Let newList be « ».
+ Vector<Utf16String> new_list;
+ new_list.ensure_capacity(list.size());
+
+ // 2. For each item in list, append the result of canonicalizing item to newList.
+ for (auto const& item : list)
+ new_list.unchecked_append(canonicalize_sanitizer_processing_instruction(item));
+
+ // 3. Return newList.
+ return new_list;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-sanitizer-element-with-attributes
+template<typename Element>
+static SanitizerElementWithAttributes canonicalize_a_sanitizer_element_with_attributes(Element const& element)
+{
+ // 1. Let result be the result of canonicalizing element.
+ SanitizerElementWithAttributes result { canonicalize_a_sanitizer_element(element), {}, {} };
+
+ // 2. If element is a dictionary:
+ if (auto const* dictionary = element.template get_pointer<Bindings::SanitizerElementNamespaceWithAttributes>()) {
+ // 1. If element["attributes"] exists, then set result["attributes"] to the result of canonicalizing
+ // element["attributes"].
+ if (dictionary->attributes.has_value())
+ result.attributes = canonicalize_a_sanitizer_list(*dictionary->attributes);
+
+ // 2. If element["removeAttributes"] exists, then set result["removeAttributes"] to the result of
+ // canonicalizing element["removeAttributes"].
+ if (dictionary->remove_attributes.has_value())
+ result.remove_attributes = canonicalize_a_sanitizer_list(*dictionary->remove_attributes);
+ }
+
+ // 3. If neither result["attributes"] nor result["removeAttributes"] exists, then set result["removeAttributes"]
+ // to an empty list.
+ if (!result.attributes.has_value() && !result.remove_attributes.has_value())
+ result.remove_attributes = Vector<SanitizerName> {};
+
+ // 4. Return result.
+ return result;
+}
+
+SanitizerName canonicalize_sanitizer_element(Variant<Utf16String, Bindings::SanitizerElementNamespace> const& element)
+{
+ return canonicalize_a_sanitizer_element(element);
+}
+
+SanitizerElementWithAttributes canonicalize_sanitizer_element_with_attributes(Variant<Utf16String, Bindings::SanitizerElementNamespaceWithAttributes> const& element)
+{
+ return canonicalize_a_sanitizer_element_with_attributes(element);
+}
+
+SanitizerName canonicalize_sanitizer_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const& attribute)
+{
+ return canonicalize_a_sanitizer_attribute(attribute);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-a-processing-instruction
+Utf16String canonicalize_sanitizer_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const& pi)
+{
+ return pi.visit(
+ // 1. If pi is a DOMString, then return «[ "target" → pi ]».
+ [](Utf16String const& string) { return string; },
+ // 2. Assert: pi is a dictionary and pi["target"] exists.
+ // 3. Return «[ "target" → pi["target"] ]».
+ [](Bindings::SanitizerProcessingInstruction const& dictionary) { return dictionary.target; });
+}
+
+// NB: This performs the per-item canonicalization steps of "canonicalize the configuration" on a dictionary supplied
+// by script. The remaining steps are performed by canonicalize_the_configuration().
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-the-configuration
+SanitizerConfiguration canonicalize_sanitizer_config(Bindings::SanitizerConfig const& configuration)
+{
+ SanitizerConfiguration result;
+
+ // 4. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. Let newElements be « ».
+ Vector<SanitizerElementWithAttributes> new_elements;
+ new_elements.ensure_capacity(configuration.elements->size());
+
+ // 2. For each element of configuration["elements"], append the result of canonicalizing element to
+ // newElements.
+ for (auto const& element : *configuration.elements)
+ new_elements.unchecked_append(canonicalize_a_sanitizer_element_with_attributes(element));
+
+ // 3. Set configuration["elements"] to newElements.
+ result.elements = move(new_elements);
+ }
+
+ // 5. If configuration["removeElements"] exists, then set configuration["removeElements"] to the result of
+ // canonicalizing configuration["removeElements"].
+ if (configuration.remove_elements.has_value())
+ result.remove_elements = canonicalize_a_sanitizer_element_list(*configuration.remove_elements);
+
+ // 6. If configuration["attributes"] exists, then set configuration["attributes"] to the result of canonicalizing
+ // configuration["attributes"].
+ if (configuration.attributes.has_value())
+ result.attributes = canonicalize_a_sanitizer_list(*configuration.attributes);
+
+ // 7. If configuration["removeAttributes"] exists, then set configuration["removeAttributes"] to the result of
+ // canonicalizing configuration["removeAttributes"].
+ if (configuration.remove_attributes.has_value())
+ result.remove_attributes = canonicalize_a_sanitizer_list(*configuration.remove_attributes);
+
+ // 8. If configuration["replaceWithChildrenElements"] exists, then set configuration["replaceWithChildrenElements"]
+ // to the result of canonicalizing configuration["replaceWithChildrenElements"].
+ if (configuration.replace_with_children_elements.has_value())
+ result.replace_with_children_elements = canonicalize_a_sanitizer_element_list(*configuration.replace_with_children_elements);
+
+ // 9. If configuration["processingInstructions"] exists, then set configuration["processingInstructions"] to the
+ // result of canonicalizing configuration["processingInstructions"].
+ if (configuration.processing_instructions.has_value())
+ result.processing_instructions = canonicalize_a_processing_instruction_list(*configuration.processing_instructions);
+
+ // 10. If configuration["removeProcessingInstructions"] exists, then set
+ // configuration["removeProcessingInstructions"] to the result of canonicalizing
+ // configuration["removeProcessingInstructions"].
+ if (configuration.remove_processing_instructions.has_value())
+ result.remove_processing_instructions = canonicalize_a_processing_instruction_list(*configuration.remove_processing_instructions);
+
+ result.comments = configuration.comments;
+ result.data_attributes = configuration.data_attributes;
+ result.javascript_urls = configuration.javascript_ur_ls;
+
+ return result;
+}
+
+// NB: This performs the steps of "canonicalize the configuration" that do not canonicalize individual items. Items of
+// a SanitizerConfiguration are always canonical, see canonicalize_sanitizer_config().
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#canonicalize-the-configuration
+void canonicalize_the_configuration(SanitizerConfiguration& configuration, PermissiveDefaults permissive_defaults)
+{
+ bool permissive = permissive_defaults == PermissiveDefaults::Yes;
+
+ // 1. If neither configuration["elements"] nor configuration["removeElements"] exists, then set
+ // configuration["removeElements"] to an empty list.
+ if (!configuration.elements.has_value() && !configuration.remove_elements.has_value())
+ configuration.remove_elements = Vector<SanitizerName> {};
+
+ // 2. If neither configuration["attributes"] nor configuration["removeAttributes"] exists, then set
+ // configuration["removeAttributes"] to an empty list.
+ if (!configuration.attributes.has_value() && !configuration.remove_attributes.has_value())
+ configuration.remove_attributes = Vector<SanitizerName> {};
+
+ // 3. If neither configuration["processingInstructions"] nor configuration["removeProcessingInstructions"] exists:
+ if (!configuration.processing_instructions.has_value() && !configuration.remove_processing_instructions.has_value()) {
+ // 1. If permissiveDefaults is true, then set configuration["removeProcessingInstructions"] to an empty list.
+ if (permissive)
+ configuration.remove_processing_instructions = Vector<Utf16String> {};
+ // 2. Otherwise, set configuration["processingInstructions"] to an empty list.
+ else
+ configuration.processing_instructions = Vector<Utf16String> {};
+ }
+
+ // NB: Steps 4 to 10 canonicalize individual items, which canonicalize_sanitizer_config() has done.
+
+ // 11. If configuration["comments"] does not exist, then set it to permissiveDefaults.
+ if (!configuration.comments.has_value())
+ configuration.comments = permissive;
+
+ // 12. If configuration["attributes"] exists and configuration["dataAttributes"] does not exist, then set it to
+ // permissiveDefaults.
+ if (configuration.attributes.has_value() && !configuration.data_attributes.has_value())
+ configuration.data_attributes = permissive;
+
+ // 13. If configuration["javascriptURLs"] does not exist, then set it to permissiveDefaults.
+ if (!configuration.javascript_urls.has_value())
+ configuration.javascript_urls = permissive;
+}
+
+bool sanitizer_list_contains(Vector<SanitizerName> const& list, SanitizerName const& item)
+{
+ return list.contains_slow(item);
+}
+
+static bool sanitizer_list_contains(Optional<Vector<SanitizerName>> const& list, SanitizerName const& item)
+{
+ return list.has_value() && sanitizer_list_contains(*list, item);
+}
+
+// NB: Returns whether the list contained the item.
+bool sanitizer_list_remove(Optional<Vector<SanitizerName>>& list, SanitizerName const& item)
+{
+ if (!list.has_value())
+ return false;
+ return list->remove_all_matching([&](auto const& entry) { return entry == item; });
+}
+
+static SanitizerElementWithAttributes const* find_element(Optional<Vector<SanitizerElementWithAttributes>> const& elements, Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_)
+{
+ if (!elements.has_value())
+ return nullptr;
+ for (auto const& element : *elements) {
+ if (element.element.name == local_name && element.element.namespace_ == namespace_)
+ return &element;
+ }
+ return nullptr;
+}
+
+static bool elements_contain(Optional<Vector<SanitizerElementWithAttributes>> const& elements, SanitizerName const& name)
+{
+ return find_element(elements, name.name, name.namespace_);
+}
+
+static bool elements_remove(Optional<Vector<SanitizerElementWithAttributes>>& elements, SanitizerName const& name)
+{
+ if (!elements.has_value())
+ return false;
+ return elements->remove_all_matching([&](auto const& entry) { return entry.element == name; });
+}
+
+// https://infra.spec.whatwg.org/#list-has-duplicates
+static bool has_duplicates(Vector<SanitizerName> const& list)
+{
+ for (size_t i = 0; i < list.size(); ++i) {
+ for (size_t j = i + 1; j < list.size(); ++j) {
+ if (list[i] == list[j])
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool has_duplicates(Vector<SanitizerElementWithAttributes> const& list)
+{
+ for (size_t i = 0; i < list.size(); ++i) {
+ for (size_t j = i + 1; j < list.size(); ++j) {
+ if (list[i].element == list[j].element)
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool has_duplicates(Vector<Utf16String> const& list)
+{
+ for (size_t i = 0; i < list.size(); ++i) {
+ for (size_t j = i + 1; j < list.size(); ++j) {
+ if (list[i] == list[j])
+ return true;
+ }
+ }
+ return false;
+}
+
+// https://infra.spec.whatwg.org/#set-intersection
+template<typename A, typename B>
+static bool intersection_is_empty(A const& a, B const& b)
+{
+ for (auto const& item : a) {
+ for (auto const& other : b) {
+ if constexpr (IsSame<RemoveCVReference<decltype(item)>, SanitizerElementWithAttributes>) {
+ if (item.element == other)
+ return false;
+ } else {
+ if (item == other)
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+// https://infra.spec.whatwg.org/#set-subset
+static bool is_subset(Vector<SanitizerName> const& subset, Vector<SanitizerName> const& superset)
+{
+ for (auto const& item : subset) {
+ if (!sanitizer_list_contains(superset, item))
+ return false;
+ }
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dom.html#custom-data-attribute
+bool is_custom_data_attribute(SanitizerName const& attribute)
+{
+ // A custom data attribute is an attribute in no namespace whose name starts with the string "data-", has at least
+ // one character after the hyphen, is a valid attribute local name, and contains no ASCII upper alphas.
+ if (attribute.namespace_.has_value())
+ return false;
+ auto name = attribute.name.view();
+ if (!name.starts_with("data-"sv) || name.length_in_code_units() <= 5)
+ return false;
+ if (!DOM::is_valid_attribute_local_name(name))
+ return false;
+ for (size_t i = 0; i < name.length_in_code_units(); ++i) {
+ if (is_ascii_upper_alpha(name.code_unit_at(i)))
+ return false;
+ }
+ return true;
+}
+
+static bool contains_custom_data_attribute(Vector<SanitizerName> const& list)
+{
+ return list.contains([](auto const& attribute) { return is_custom_data_attribute(attribute); });
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizerconfig-valid
+bool sanitizer_configuration_is_valid(SanitizerConfiguration const& config)
+{
+ // 1. Assert: config["elements"] exists or config["removeElements"] exists.
+ VERIFY(config.elements.has_value() || config.remove_elements.has_value());
+
+ // 2. If config["elements"] exists and config["removeElements"] exists, then return false.
+ if (config.elements.has_value() && config.remove_elements.has_value())
+ return false;
+
+ // 3. Assert: Either config["processingInstructions"] exists or config["removeProcessingInstructions"] exists.
+ VERIFY(config.processing_instructions.has_value() || config.remove_processing_instructions.has_value());
+
+ // 4. If config["processingInstructions"] exists and config["removeProcessingInstructions"] exists, then return
+ // false.
+ if (config.processing_instructions.has_value() && config.remove_processing_instructions.has_value())
+ return false;
+
+ // 5. Assert: Either config["attributes"] exists or config["removeAttributes"] exists.
+ VERIFY(config.attributes.has_value() || config.remove_attributes.has_value());
+
+ // 6. If config["attributes"] exists and config["removeAttributes"] exists, then return false.
+ if (config.attributes.has_value() && config.remove_attributes.has_value())
+ return false;
+
+ // 7. Assert: All SanitizerElementNamespaceWithAttributes, SanitizerElementNamespace,
+ // SanitizerProcessingInstruction, and SanitizerAttributeNamespace items in config are canonical, meaning they
+ // have been run through canonicalizing, as appropriate.
+ // NB: The items of a SanitizerConfiguration are canonical by construction.
+
+ // 8. If config["elements"] exists:
+ if (config.elements.has_value()) {
+ // 1. If config["elements"] has duplicates, then return false.
+ if (has_duplicates(*config.elements))
+ return false;
+ }
+ // 9. Otherwise:
+ else {
+ // 1. If config["removeElements"] has duplicates, then return false.
+ if (has_duplicates(*config.remove_elements))
+ return false;
+ }
+
+ // 10. If config["replaceWithChildrenElements"] exists and has duplicates, then return false.
+ if (config.replace_with_children_elements.has_value() && has_duplicates(*config.replace_with_children_elements))
+ return false;
+
+ // 11. If config["processingInstructions"] exists:
+ if (config.processing_instructions.has_value()) {
+ // 1. If config["processingInstructions"] has duplicates, then return false.
+ if (has_duplicates(*config.processing_instructions))
+ return false;
+ }
+ // 12. Otherwise:
+ else {
+ // 1. If config["removeProcessingInstructions"] has duplicates, then return false.
+ if (has_duplicates(*config.remove_processing_instructions))
+ return false;
+ }
+
+ // 13. If config["attributes"] exists:
+ if (config.attributes.has_value()) {
+ // 1. If config["attributes"] has duplicates, then return false.
+ if (has_duplicates(*config.attributes))
+ return false;
+ }
+ // 14. Otherwise:
+ else {
+ // 1. If config["removeAttributes"] has duplicates, then return false.
+ if (has_duplicates(*config.remove_attributes))
+ return false;
+ }
+
+ // 15. If config["replaceWithChildrenElements"] exists:
+ if (config.replace_with_children_elements.has_value()) {
+ // 1. For each element of config["replaceWithChildrenElements"]:
+ for (auto const& element : *config.replace_with_children_elements) {
+ // 1. If the built-in non-replaceable elements list contains element, then return false.
+ if (built_in_non_replaceable_elements_list_contains(element))
+ return false;
+ }
+
+ // 2. If config["elements"] exists:
+ if (config.elements.has_value()) {
+ // 1. If the intersection of config["elements"] and config["replaceWithChildrenElements"] is not empty, then
+ // return false.
+ if (!intersection_is_empty(*config.elements, *config.replace_with_children_elements))
+ return false;
+ }
+ // 3. Otherwise:
+ else {
+ // 1. If the intersection of config["removeElements"] and config["replaceWithChildrenElements"] is not
+ // empty, then return false.
+ if (!intersection_is_empty(*config.remove_elements, *config.replace_with_children_elements))
+ return false;
+ }
+ }
+
+ // 16. If config["attributes"] exists:
+ if (config.attributes.has_value()) {
+ // 1. Assert: config["dataAttributes"] exists.
+ VERIFY(config.data_attributes.has_value());
+
+ // 2. If config["elements"] exists:
+ if (config.elements.has_value()) {
+ // 1. For each element of config["elements"]:
+ for (auto const& element : *config.elements) {
+ // 1. If element["attributes"] exists and element["attributes"] has duplicates, then return false.
+ if (element.attributes.has_value() && has_duplicates(*element.attributes))
+ return false;
+
+ // 2. If element["removeAttributes"] exists and element["removeAttributes"] has duplicates, then return
+ // false.
+ if (element.remove_attributes.has_value() && has_duplicates(*element.remove_attributes))
+ return false;
+
+ // 3. If the intersection of config["attributes"] and element["attributes"] with default « » is not
+ // empty, then return false.
+ if (element.attributes.has_value() && !intersection_is_empty(*config.attributes, *element.attributes))
+ return false;
+
+ // 4. If element["removeAttributes"] with default « » is not a subset of config["attributes"], then
+ // return false.
+ if (element.remove_attributes.has_value() && !is_subset(*element.remove_attributes, *config.attributes))
+ return false;
+
+ // 5. If config["dataAttributes"] is true and element["attributes"] contains a custom data attribute,
+ // then return false.
+ if (*config.data_attributes && element.attributes.has_value() && contains_custom_data_attribute(*element.attributes))
+ return false;
+ }
+ }
+
+ // 3. If config["dataAttributes"] is true and config["attributes"] contains a custom data attribute, then return
+ // false.
+ if (*config.data_attributes && contains_custom_data_attribute(*config.attributes))
+ return false;
+ }
+ // 17. Otherwise:
+ else {
+ // 1. If config["elements"] exists:
+ if (config.elements.has_value()) {
+ // 1. For each element of config["elements"]:
+ for (auto const& element : *config.elements) {
+ // 1. If element["attributes"] exists and element["removeAttributes"] exists, then return false.
+ if (element.attributes.has_value() && element.remove_attributes.has_value())
+ return false;
+
+ // 2. If element["attributes"] exists and element["attributes"] has duplicates, then return false.
+ if (element.attributes.has_value() && has_duplicates(*element.attributes))
+ return false;
+
+ // 3. If element["removeAttributes"] exists and element["removeAttributes"] has duplicates, then return
+ // false.
+ if (element.remove_attributes.has_value() && has_duplicates(*element.remove_attributes))
+ return false;
+
+ // 4. If the intersection of config["removeAttributes"] and element["attributes"] with default « » is
+ // not empty, then return false.
+ if (element.attributes.has_value() && !intersection_is_empty(*config.remove_attributes, *element.attributes))
+ return false;
+
+ // 5. If the intersection of config["removeAttributes"] and element["removeAttributes"] with default « »
+ // is not empty, then return false.
+ if (element.remove_attributes.has_value() && !intersection_is_empty(*config.remove_attributes, *element.remove_attributes))
+ return false;
+ }
+ }
+
+ // 2. If config["dataAttributes"] exists, then return false.
+ if (config.data_attributes.has_value())
+ return false;
+ }
+
+ // 18. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#configure-a-sanitizer
+WebIDL::ExceptionOr<SanitizerConfiguration> configure_sanitizer_configuration(SanitizerConfiguration fresh_configuration, PermissiveDefaults permissive_defaults)
+{
+ // 1. Let freshConfiguration be a clone of configuration.
+ // NB: The caller passes a clone.
+
+ // 2. Canonicalize the configuration freshConfiguration with permissiveDefaults.
+ canonicalize_the_configuration(fresh_configuration, permissive_defaults);
+
+ // 3. If freshConfiguration is not valid, then throw a TypeError.
+ if (!sanitizer_configuration_is_valid(fresh_configuration))
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Sanitizer configuration is not valid"_utf16 };
+
+ // 4. Set sanitizer's configuration to freshConfiguration.
+ // NB: The caller stores the result.
+ return fresh_configuration;
+}
+
+static Bindings::SanitizerElementNamespace to_bindings_name(SanitizerName const& name)
+{
+ Bindings::SanitizerElementNamespace result;
+ result.name = name.name.to_utf16_string();
+ result.namespace_ = name.namespace_.map([](auto const& namespace_) { return namespace_.to_utf16_string(); });
+ return result;
+}
+
+static Vector<Variant<Utf16String, Bindings::SanitizerAttributeNamespace>> to_bindings_attribute_list(Vector<SanitizerName> const& list)
+{
+ Vector<Variant<Utf16String, Bindings::SanitizerAttributeNamespace>> result;
+ result.ensure_capacity(list.size());
+ for (auto const& item : list) {
+ Bindings::SanitizerAttributeNamespace attribute;
+ attribute.name = item.name.to_utf16_string();
+ attribute.namespace_ = item.namespace_.map([](auto const& namespace_) { return namespace_.to_utf16_string(); });
+ result.unchecked_append(move(attribute));
+ }
+ return result;
+}
+
+static Vector<Variant<Utf16String, Bindings::SanitizerElementNamespace>> to_bindings_element_list(Vector<SanitizerName> const& list)
+{
+ Vector<Variant<Utf16String, Bindings::SanitizerElementNamespace>> result;
+ result.ensure_capacity(list.size());
+ for (auto const& item : list)
+ result.unchecked_append(to_bindings_name(item));
+ return result;
+}
+
+static Vector<Variant<Utf16String, Bindings::SanitizerProcessingInstruction>> to_bindings_processing_instruction_list(Vector<Utf16String> const& list)
+{
+ Vector<Variant<Utf16String, Bindings::SanitizerProcessingInstruction>> result;
+ result.ensure_capacity(list.size());
+ for (auto const& item : list) {
+ Bindings::SanitizerProcessingInstruction processing_instruction;
+ processing_instruction.target = item;
+ result.unchecked_append(move(processing_instruction));
+ }
+ return result;
+}
+
+Bindings::SanitizerConfig sanitizer_configuration_to_bindings(SanitizerConfiguration const& configuration)
+{
+ Bindings::SanitizerConfig result;
+ if (configuration.elements.has_value()) {
+ Vector<Variant<Utf16String, Bindings::SanitizerElementNamespaceWithAttributes>> elements;
+ elements.ensure_capacity(configuration.elements->size());
+ for (auto const& element : *configuration.elements) {
+ Bindings::SanitizerElementNamespaceWithAttributes dictionary;
+ dictionary.name = element.element.name.to_utf16_string();
+ dictionary.namespace_ = element.element.namespace_.map([](auto const& namespace_) { return namespace_.to_utf16_string(); });
+ if (element.attributes.has_value())
+ dictionary.attributes = to_bindings_attribute_list(*element.attributes);
+ if (element.remove_attributes.has_value())
+ dictionary.remove_attributes = to_bindings_attribute_list(*element.remove_attributes);
+ elements.unchecked_append(move(dictionary));
+ }
+ result.elements = move(elements);
+ }
+ if (configuration.remove_elements.has_value())
+ result.remove_elements = to_bindings_element_list(*configuration.remove_elements);
+ if (configuration.replace_with_children_elements.has_value())
+ result.replace_with_children_elements = to_bindings_element_list(*configuration.replace_with_children_elements);
+ if (configuration.processing_instructions.has_value())
+ result.processing_instructions = to_bindings_processing_instruction_list(*configuration.processing_instructions);
+ if (configuration.remove_processing_instructions.has_value())
+ result.remove_processing_instructions = to_bindings_processing_instruction_list(*configuration.remove_processing_instructions);
+ if (configuration.attributes.has_value())
+ result.attributes = to_bindings_attribute_list(*configuration.attributes);
+ if (configuration.remove_attributes.has_value())
+ result.remove_attributes = to_bindings_attribute_list(*configuration.remove_attributes);
+ result.comments = configuration.comments;
+ result.data_attributes = configuration.data_attributes;
+ result.javascript_ur_ls = configuration.javascript_urls;
+ return result;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#remove-an-element-from-sanitizer-config
+bool remove_an_element_from_sanitizer_config(SanitizerConfiguration& configuration, SanitizerName const& element)
+{
+ // 1. Assert: configuration is valid.
+ // 2. Set element to the result of canonicalizing element.
+ // NB: element is canonical.
+
+ // 3. Let modified be the result of removing element from configuration["replaceWithChildrenElements"].
+ bool modified = sanitizer_list_remove(configuration.replace_with_children_elements, element);
+
+ // 4. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. If configuration["elements"] contains element:
+ if (elements_contain(configuration.elements, element)) {
+ // 1. Remove element from configuration["elements"].
+ elements_remove(configuration.elements, element);
+
+ // 2. Return true.
+ return true;
+ }
+
+ // 2. Return modified.
+ return modified;
+ }
+
+ // 5. Otherwise:
+ // 1. If configuration["removeElements"] contains element, then return modified.
+ if (sanitizer_list_contains(*configuration.remove_elements, element))
+ return modified;
+
+ // 2. Append element to configuration["removeElements"].
+ configuration.remove_elements->append(element);
+
+ // 3. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#remove-an-attribute-from-sanitizer-config
+bool remove_an_attribute_from_sanitizer_config(SanitizerConfiguration& configuration, SanitizerName const& attribute)
+{
+ // 1. Assert: configuration is valid.
+ // 2. Set attribute to the result of canonicalizing attribute.
+ // NB: attribute is canonical.
+
+ // 3. If configuration["attributes"] exists:
+ if (configuration.attributes.has_value()) {
+ // 1. Let modified be the result of removing attribute from configuration["attributes"].
+ bool modified = sanitizer_list_remove(configuration.attributes, attribute);
+
+ // 2. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. For each element of configuration["elements"]:
+ for (auto& element : *configuration.elements) {
+ // 1. If element["attributes"] with default « » contains attribute:
+ if (sanitizer_list_contains(element.attributes, attribute)) {
+ // 1. Set modified to true.
+ modified = true;
+
+ // 2. Remove attribute from element["attributes"].
+ sanitizer_list_remove(element.attributes, attribute);
+ }
+
+ // 2. If element["removeAttributes"] with default « » contains attribute:
+ if (sanitizer_list_contains(element.remove_attributes, attribute)) {
+ // 1. Assert: modified is true.
+ VERIFY(modified);
+
+ // 2. Remove attribute from element["removeAttributes"].
+ sanitizer_list_remove(element.remove_attributes, attribute);
+ }
+ }
+ }
+
+ // 3. Return modified.
+ return modified;
+ }
+
+ // 4. Otherwise:
+ // 1. If configuration["removeAttributes"] contains attribute, then return false.
+ if (sanitizer_list_contains(*configuration.remove_attributes, attribute))
+ return false;
+
+ // 2. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. For each element in configuration["elements"]:
+ for (auto& element : *configuration.elements) {
+ // 1. If element["attributes"] with default « » contains attribute, then remove attribute from
+ // element["attributes"].
+ sanitizer_list_remove(element.attributes, attribute);
+
+ // 2. If element["removeAttributes"] with default « » contains attribute, then remove attribute from
+ // element["removeAttributes"].
+ sanitizer_list_remove(element.remove_attributes, attribute);
+ }
+ }
+
+ // 3. Append attribute to configuration["removeAttributes"].
+ configuration.remove_attributes->append(attribute);
+
+ // 4. Return true.
+ return true;
+}
+
+static Vector<SanitizerName> const& event_handler_content_attributes()
+{
+ static NeverDestroyed<Vector<SanitizerName> const> attributes { [] {
+ Vector<SanitizerName> attributes;
+#define __ENUMERATE(attribute_name, event_name) \
+ attributes.append({ HTML::AttributeNames::attribute_name, {} });
+ ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
+ ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
+#undef __ENUMERATE
+ attributes.append({ "onbegin"_utf16_fly_string, {} });
+ attributes.append({ "onend"_utf16_fly_string, {} });
+ attributes.append({ "onrepeat"_utf16_fly_string, {} });
+ return attributes;
+ }() };
+ return *attributes;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#remove-unsafe
+bool remove_unsafe_from_sanitizer_config(SanitizerConfiguration& configuration)
+{
+ // 1. Assert: configuration is valid.
+
+ // 2. Let result be false.
+ bool result = false;
+
+ // 3. For each element in built-in safe baseline configuration["removeElements"]:
+ for (auto const& element : *built_in_safe_baseline_configuration().remove_elements) {
+ // 1. If removing element from configuration is true, then set result to true.
+ if (remove_an_element_from_sanitizer_config(configuration, element))
+ result = true;
+ }
+
+ // 4. For each attribute in built-in safe baseline configuration["removeAttributes"]:
+ for (auto const& attribute : *built_in_safe_baseline_configuration().remove_attributes) {
+ // 1. If removing attribute from configuration is true, then set result to true.
+ if (remove_an_attribute_from_sanitizer_config(configuration, attribute))
+ result = true;
+ }
+
+ // 5. For each attribute that is an event handler content attribute:
+ for (auto const& attribute : event_handler_content_attributes()) {
+ // 1. If removing attribute from configuration is true, then set result to true.
+ if (remove_an_attribute_from_sanitizer_config(configuration, attribute))
+ result = true;
+ }
+
+ // 6. If configuration["javascriptURLs"] is true:
+ if (configuration.javascript_urls == true) {
+ // 1. Set result to true.
+ result = true;
+
+ // 2. Set configuration["javascriptURLs"] to false.
+ configuration.javascript_urls = false;
+ }
+
+ // 7. Return result.
+ return result;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-config-allows-comments
+bool sanitizer_config_allows_comments(SanitizerConfiguration const& configuration)
+{
+ // Return true if configuration["comments"] is true; otherwise false.
+ return configuration.comments == true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-config-allows-processing-instruction-target
+bool sanitizer_config_allows_processing_instruction_target(Utf16View const& pi_target, SanitizerConfiguration const& configuration)
+{
+ // 1. Let pi be «[ "target" → piTarget ]».
+ auto contains = [&](Vector<Utf16String> const& list) {
+ return list.contains([&](auto const& target) { return target.utf16_view() == pi_target; });
+ };
+
+ // 2. If configuration["processingInstructions"] exists, then return whether
+ // configuration["processingInstructions"] contains pi.
+ if (configuration.processing_instructions.has_value())
+ return contains(*configuration.processing_instructions);
+
+ // 3. If configuration["removeProcessingInstructions"] exists and configuration["removeProcessingInstructions"]
+ // contains pi, then return false.
+ if (configuration.remove_processing_instructions.has_value() && contains(*configuration.remove_processing_instructions))
+ return false;
+
+ // 4. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#get-the-sanitizer-action-for-an-element-name
+SanitizerAction sanitizer_action_for_element_name(Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_, SanitizerConfiguration const& configuration)
+{
+ // 1. Let elementName be «[ "name" → localName, "namespace" → namespace ]».
+ SanitizerName element_name { local_name, namespace_ };
+
+ // 2. If configuration["replaceWithChildrenElements"] exists and configuration["replaceWithChildrenElements"]
+ // contains elementName, then return "Replace with children".
+ if (sanitizer_list_contains(configuration.replace_with_children_elements, element_name))
+ return SanitizerAction::ReplaceWithChildren;
+
+ // 3. If configuration["elements"] exists:
+ if (configuration.elements.has_value()) {
+ // 1. If there is no item in configuration["elements"] whose name member is localName and whose namespace
+ // member is namespace, then return "Remove".
+ if (!find_element(configuration.elements, local_name, namespace_))
+ return SanitizerAction::Remove;
+ }
+ // 4. Otherwise, if configuration["removeElements"] contains elementName, then return "Remove".
+ else if (sanitizer_list_contains(configuration.remove_elements, element_name)) {
+ return SanitizerAction::Remove;
+ }
+
+ // 5. Return "Keep".
+ return SanitizerAction::Keep;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#contains-a-javascript:-url
+static bool contains_a_javascript_url(Utf16View const& value)
+{
+ // 1. Let url be the result of running the basic URL parser on value.
+ auto url = URL::Parser::basic_parse(value);
+
+ // 2. If url is failure, then return false.
+ if (!url.has_value())
+ return false;
+
+ // 3. Return true if url's scheme is "javascript", and false otherwise.
+ return url->scheme() == "javascript"sv;
+}
+
+struct NavigatingURLAttribute {
+ Utf16FlyString const& element_name;
+ Utf16FlyString const& element_namespace;
+ Utf16FlyString const& attribute_name;
+ Utf16FlyString const* attribute_namespace;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#built-in-navigating-url-attributes-list
+static bool built_in_navigating_url_attributes_list_matches(SanitizerName const& element_name, SanitizerName const& attribute_name)
+{
+ // The built-in navigating URL attributes list corresponds to all HTML elements marked with navigating URL
+ // attributes in their normative definitions, as well as the element-attribute pairs represented in the following
+ // table.
+ static NavigatingURLAttribute const list[] = {
+ { HTML::TagNames::a, Namespace::HTML, HTML::AttributeNames::href, nullptr },
+ { HTML::TagNames::area, Namespace::HTML, HTML::AttributeNames::href, nullptr },
+ { HTML::TagNames::form, Namespace::HTML, HTML::AttributeNames::action, nullptr },
+ { HTML::TagNames::input, Namespace::HTML, HTML::AttributeNames::formaction, nullptr },
+ { HTML::TagNames::button, Namespace::HTML, HTML::AttributeNames::formaction, nullptr },
+ { HTML::TagNames::a, Namespace::SVG, HTML::AttributeNames::href, nullptr },
+ { HTML::TagNames::a, Namespace::SVG, HTML::AttributeNames::href, &Namespace::XLink },
+ };
+ for (auto const& entry : list) {
+ if (element_name.name != entry.element_name || element_name.namespace_ != entry.element_namespace)
+ continue;
+ if (attribute_name.name != entry.attribute_name)
+ continue;
+ if (entry.attribute_namespace) {
+ if (attribute_name.namespace_ == *entry.attribute_namespace)
+ return true;
+ } else if (!attribute_name.namespace_.has_value()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#built-in-animating-url-attributes-list
+static bool built_in_animating_url_attributes_list_contains(SanitizerName const& element_name, SanitizerName const& attribute_name)
+{
+ if (element_name.namespace_ != Namespace::SVG || attribute_name.namespace_.has_value())
+ return false;
+ if (attribute_name.name != "attributeName"_utf16_fly_string)
+ return false;
+ return element_name.name.is_one_of("animate"_utf16_fly_string, "animateTransform"_utf16_fly_string, "set"_utf16_fly_string);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-config-allows-an-attribute
+bool sanitizer_config_allows_attribute(Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_, Utf16View const& value, Utf16FlyString const& element_local_name, Optional<Utf16FlyString> const& element_namespace, SanitizerConfiguration const& configuration)
+{
+ // 1. Let attrName be «[ "name" → localName, "namespace" → namespace ]».
+ SanitizerName attribute_name { local_name, namespace_ };
+
+ // 2. Let elementName be «[ "name" → elementLocalName, "namespace" → elementNamespace ]».
+ SanitizerName element_name { element_local_name, element_namespace };
+
+ // 3. Let elementWithLocalAttributes be «[ ]».
+ // 4. If configuration["elements"] exists and there is an item element in configuration["elements"] whose name
+ // member is elementLocalName and whose namespace member is elementNamespace, then set
+ // elementWithLocalAttributes to element.
+ auto const* element_with_local_attributes = find_element(configuration.elements, element_local_name, element_namespace);
+ Optional<Vector<SanitizerName>> const no_attributes;
+ auto const& local_attributes = element_with_local_attributes ? element_with_local_attributes->attributes : no_attributes;
+ auto const& local_remove_attributes = element_with_local_attributes ? element_with_local_attributes->remove_attributes : no_attributes;
+
+ // 5. If elementWithLocalAttributes["removeAttributes"] exists and elementWithLocalAttributes["removeAttributes"]
+ // contains attrName, then return false.
+ if (sanitizer_list_contains(local_remove_attributes, attribute_name))
+ return false;
+
+ // 6. Otherwise, if configuration["attributes"] exists:
+ if (configuration.attributes.has_value()) {
+ // 1. If configuration["attributes"] does not contain attrName and elementWithLocalAttributes["attributes"]
+ // with default « » does not contain attrName, and if "data-" is not a code unit prefix of localName or
+ // namespace is not null or configuration["dataAttributes"] is not true, then return false.
+ if (!sanitizer_list_contains(*configuration.attributes, attribute_name)
+ && !sanitizer_list_contains(local_attributes, attribute_name)
+ && (!local_name.view().starts_with("data-"sv) || namespace_.has_value() || configuration.data_attributes != true)) {
+ return false;
+ }
+ }
+ // 7. Otherwise:
+ else {
+ // 1. If elementWithLocalAttributes["attributes"] exists and elementWithLocalAttributes["attributes"] does not
+ // contain attrName, then return false.
+ if (local_attributes.has_value() && !sanitizer_list_contains(*local_attributes, attribute_name))
+ return false;
+
+ // 2. Otherwise, if configuration["removeAttributes"] exists and configuration["removeAttributes"] contains
+ // attrName, then return false.
+ if (sanitizer_list_contains(configuration.remove_attributes, attribute_name))
+ return false;
+ }
+
+ // 8. If configuration["javascriptURLs"] is true, then return true.
+ if (configuration.javascript_urls == true)
+ return true;
+
+ // 9. If the pair (elementName, attrName) matches an entry in the built-in navigating URL attributes list, and if
+ // value contains a javascript: URL, then return false.
+ if (built_in_navigating_url_attributes_list_matches(element_name, attribute_name) && contains_a_javascript_url(value))
+ return false;
+
+ // 10. If elementNamespace is the MathML namespace, localName is "href", namespace is null or the XLink namespace,
+ // and value contains a javascript: URL, then return false.
+ if (element_namespace == Namespace::MathML && local_name == HTML::AttributeNames::href
+ && (!namespace_.has_value() || namespace_ == Namespace::XLink)
+ && contains_a_javascript_url(value)) {
+ return false;
+ }
+
+ // 11. If the built-in animating URL attributes list contains the pair (elementName, attrName), and value is "href"
+ // or "xlink:href", then return false.
+ if (built_in_animating_url_attributes_list_contains(element_name, attribute_name) && (value == "href"sv || value == "xlink:href"sv))
+ return false;
+
+ // 12. Return true.
+ return true;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#built-in-non-replaceable-elements-list
+bool built_in_non_replaceable_elements_list_contains(SanitizerName const& element)
+{
+ return (element.name == HTML::TagNames::html && element.namespace_ == Namespace::HTML)
+ || (element.name == "svg"_utf16_fly_string && element.namespace_ == Namespace::SVG)
+ || (element.name == "math"_utf16_fly_string && element.namespace_ == Namespace::MathML);
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#built-in-safe-baseline-configuration
+SanitizerConfiguration const& built_in_safe_baseline_configuration()
+{
+ // The built-in safe baseline configuration is a SanitizerConfig. Its removeElements list consists of all HTML
+ // elements normatively marked as Unsafe within their individual definitions, along with the obsolete frame
+ // element, and the SVG script and SVG use elements, and its removeAttributes list is empty.
+ static NeverDestroyed<SanitizerConfiguration const> configuration { [] {
+ SanitizerConfiguration configuration;
+ configuration.remove_elements = Vector<SanitizerName> {
+ { HTML::TagNames::base, Namespace::HTML },
+ { HTML::TagNames::embed, Namespace::HTML },
+ { HTML::TagNames::frame, Namespace::HTML },
+ { HTML::TagNames::iframe, Namespace::HTML },
+ { HTML::TagNames::object, Namespace::HTML },
+ { HTML::TagNames::script, Namespace::HTML },
+ { HTML::TagNames::script, Namespace::SVG },
+ { "use"_utf16_fly_string, Namespace::SVG },
+ };
+ configuration.remove_attributes = Vector<SanitizerName> {};
+ return configuration;
+ }() };
+ return *configuration;
+}
+
+struct DefaultElement {
+ StringView name;
+ StringView attributes;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#built-in-safe-default-configuration
+SanitizerConfiguration const& built_in_safe_default_configuration()
+{
+ static NeverDestroyed<SanitizerConfiguration const> configuration { [] {
+ auto attribute_list = [](StringView attributes) {
+ Vector<SanitizerName> list;
+ attributes.for_each_split_view(' ', SplitBehavior::Nothing, [&](StringView attribute) {
+ list.append({ Utf16FlyString::from_utf8(attribute), {} });
+ });
+ return list;
+ };
+
+ SanitizerConfiguration configuration;
+
+ // elements
+ // All HTML elements normatively categorized as Default within their individual definitions, alongside the
+ // MathML and SVG elements listed in the table below. Attributes included in those definitions are included
+ // in each element's respective attributes list.
+ static constexpr DefaultElement html_elements[] = {
+ { "html"sv, {} },
+ { "head"sv, {} },
+ { "title"sv, {} },
+ { "body"sv, {} },
+ { "article"sv, {} },
+ { "section"sv, {} },
+ { "nav"sv, {} },
+ { "aside"sv, {} },
+ { "h1"sv, {} },
+ { "h2"sv, {} },
+ { "h3"sv, {} },
+ { "h4"sv, {} },
+ { "h5"sv, {} },
+ { "h6"sv, {} },
+ { "hgroup"sv, {} },
+ { "header"sv, {} },
+ { "footer"sv, {} },
+ { "address"sv, {} },
+ { "p"sv, {} },
+ { "hr"sv, {} },
+ { "pre"sv, {} },
+ { "blockquote"sv, "cite"sv },
+ { "ol"sv, "reversed start type"sv },
+ { "ul"sv, {} },
+ { "menu"sv, {} },
+ { "li"sv, "value"sv },
+ { "dl"sv, {} },
+ { "dt"sv, {} },
+ { "dd"sv, {} },
+ { "figure"sv, {} },
+ { "figcaption"sv, {} },
+ { "main"sv, {} },
+ { "search"sv, {} },
+ { "div"sv, {} },
+ { "a"sv, "href hreflang type"sv },
+ { "em"sv, {} },
+ { "strong"sv, {} },
+ { "small"sv, {} },
+ { "s"sv, {} },
+ { "cite"sv, {} },
+ { "q"sv, {} },
+ { "dfn"sv, {} },
+ { "abbr"sv, {} },
+ { "ruby"sv, {} },
+ { "rt"sv, {} },
+ { "rp"sv, {} },
+ { "data"sv, "value"sv },
+ { "time"sv, "datetime"sv },
+ { "code"sv, {} },
+ { "var"sv, {} },
+ { "samp"sv, {} },
+ { "kbd"sv, {} },
+ { "sub"sv, {} },
+ { "sup"sv, {} },
+ { "i"sv, {} },
+ { "b"sv, {} },
+ { "u"sv, {} },
+ { "mark"sv, {} },
+ { "bdi"sv, {} },
+ { "bdo"sv, {} },
+ { "span"sv, {} },
+ { "br"sv, {} },
+ { "wbr"sv, {} },
+ { "ins"sv, "cite datetime"sv },
+ { "del"sv, "cite datetime"sv },
+ { "table"sv, {} },
+ { "caption"sv, {} },
+ { "colgroup"sv, "span"sv },
+ { "col"sv, "span"sv },
+ { "tbody"sv, {} },
+ { "thead"sv, {} },
+ { "tfoot"sv, {} },
+ { "tr"sv, {} },
+ { "td"sv, "colspan headers rowspan"sv },
+ { "th"sv, "abbr colspan headers rowspan scope"sv },
+ };
+
+ static constexpr DefaultElement mathml_elements[] = {
+ { "a"sv, "href hreflang type"sv },
+ { "math"sv, {} },
+ { "merror"sv, {} },
+ { "mfrac"sv, {} },
+ { "mi"sv, {} },
+ { "mmultiscripts"sv, {} },
+ { "mn"sv, {} },
+ { "mo"sv, "fence form largeop lspace maxsize minsize movablelimits rspace separator stretchy symmetric"sv },
+ { "mover"sv, "accent"sv },
+ { "mpadded"sv, "depth height lspace voffset width"sv },
+ { "mphantom"sv, {} },
+ { "mprescripts"sv, {} },
+ { "mroot"sv, {} },
+ { "mrow"sv, {} },
+ { "ms"sv, {} },
+ { "mspace"sv, "depth height width"sv },
+ { "msqrt"sv, {} },
+ { "mstyle"sv, {} },
+ { "msub"sv, {} },
+ { "msubsup"sv, {} },
+ { "msup"sv, {} },
+ { "mtable"sv, {} },
+ { "mtd"sv, "columnspan rowspan"sv },
+ { "mtext"sv, {} },
+ { "mtr"sv, {} },
+ { "munder"sv, "accentunder"sv },
+ { "munderover"sv, "accent accentunder"sv },
+ { "semantics"sv, {} },
+ };
+
+ static constexpr DefaultElement svg_elements[] = {
+ { "a"sv, "href hreflang type"sv },
+ { "circle"sv, "cx cy pathLength r"sv },
+ { "defs"sv, {} },
+ { "desc"sv, {} },
+ { "ellipse"sv, "cx cy pathLength rx ry"sv },
+ { "foreignObject"sv, "height width x y"sv },
+ { "g"sv, {} },
+ { "line"sv, "pathLength x1 x2 y1 y2"sv },
+ { "marker"sv, "markerHeight markerUnits markerWidth orient preserveAspectRatio refX refY viewBox"sv },
+ { "metadata"sv, {} },
+ { "path"sv, "d pathLength"sv },
+ { "polygon"sv, "pathLength points"sv },
+ { "polyline"sv, "pathLength points"sv },
+ { "rect"sv, "height pathLength rx ry width x y"sv },
+ { "svg"sv, "height preserveAspectRatio viewBox width x y"sv },
+ { "text"sv, "dx dy lengthAdjust rotate textLength x y"sv },
+ { "textPath"sv, "lengthAdjust method path side spacing startOffset textLength"sv },
+ { "title"sv, {} },
+ { "tspan"sv, "dx dy lengthAdjust rotate textLength x y"sv },
+ };
+
+ Vector<SanitizerElementWithAttributes> elements;
+ auto append_elements = [&](ReadonlySpan<DefaultElement> list, Utf16FlyString const& namespace_) {
+ for (auto const& element : list)
+ elements.append({ { Utf16FlyString::from_utf8(element.name), namespace_ }, attribute_list(element.attributes), {} });
+ };
+ append_elements(html_elements, Namespace::HTML);
+ append_elements(mathml_elements, Namespace::MathML);
+ append_elements(svg_elements, Namespace::SVG);
+ configuration.elements = move(elements);
+
+ // processingInstructions
+ // « »
+ configuration.processing_instructions = Vector<Utf16String> {};
+
+ // attributes
+ configuration.attributes = attribute_list(
+ "dir lang title alignment-baseline baseline-shift clip-path clip-rule color color-interpolation cursor "
+ "direction display displaystyle dominant-baseline fill fill-opacity fill-rule font-family font-size "
+ "font-size-adjust font-stretch font-style font-variant font-weight letter-spacing marker-end marker-mid "
+ "marker-start mathbackground mathcolor mathsize opacity paint-order pointer-events scriptlevel "
+ "shape-rendering stop-color stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-linecap "
+ "stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-overflow "
+ "text-rendering transform transform-origin unicode-bidi vector-effect visibility white-space word-spacing "
+ "writing-mode"sv);
+
+ // comments
+ // false
+ configuration.comments = false;
+
+ // dataAttributes
+ // false
+ configuration.data_attributes = false;
+
+ // javascriptURLs
+ // false
+ configuration.javascript_urls = false;
+
+ return configuration;
+ }() };
+ return *configuration;
+}
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#get-a-sanitizer-config-from-options
+WebIDL::ExceptionOr<Optional<SanitizerConfiguration>> get_a_sanitizer_config_from_options(SanitizerOptions const& options, SanitizerSafety safety)
+{
+ bool safe = safety == SanitizerSafety::Safe;
+
+ // 1. Let sanitizerInput be null.
+ using SanitizerInput = Variant<Empty, GC::Ref<Sanitizer>, Bindings::SanitizerConfig const*, SanitizerConfiguration const*>;
+ SanitizerInput sanitizer_input;
+
+ auto set_sanitizer_input = [&](auto const& sanitizer) {
+ sanitizer.visit(
+ [&](Bindings::SanitizerConfig const& config) { sanitizer_input = &config; },
+ [&](Bindings::SanitizerPresets preset) {
+ // 1. Assert: sanitizerInput is "default".
+ VERIFY(preset == Bindings::SanitizerPresets::Default);
+
+ // 2. Set sanitizerInput to the built-in safe default configuration.
+ sanitizer_input = &built_in_safe_default_configuration();
+ },
+ [&](auto const& sanitizer_object) { sanitizer_input = GC::Ref<Sanitizer> { *sanitizer_object }; });
+ };
+
+ // 2. If options is a TrustedHTMLParserOptions:
+ if (auto const* trusted_options = options.get_pointer<GC::Ref<TrustedTypes::TrustedHTMLParserOptions>>()) {
+ // 1. If options's sanitizer configuration is null:
+ if (!(*trusted_options)->sanitizer_configuration().has_value()) {
+ // 1. Assert: safe is false.
+ VERIFY(!safe);
+
+ // 2. Return null.
+ return Optional<SanitizerConfiguration> {};
+ }
+
+ // 2. Set sanitizerInput to options's sanitizer configuration.
+ sanitizer_input = &*(*trusted_options)->sanitizer_configuration();
+ }
+
+ // 3. Otherwise, if options["sanitizer"] exists, then set sanitizerInput to options["sanitizer"].
+ bool has_sanitizer = options.visit(
+ [&](GC::Ref<TrustedTypes::TrustedHTMLParserOptions>) {
+ return true;
+ },
+ [&](Bindings::SetHTMLOptions const* set_html_options) {
+ set_sanitizer_input(set_html_options->sanitizer);
+ return true;
+ },
+ [&](auto const* dictionary) {
+ if (!dictionary->sanitizer.has_value())
+ return false;
+ set_sanitizer_input(*dictionary->sanitizer);
+ return true;
+ });
+
+ if (!has_sanitizer) {
+ // 4. Otherwise, if safe is false, then return null.
+ if (!safe)
+ return Optional<SanitizerConfiguration> {};
+
+ // 5. Otherwise, set sanitizerInput to "default".
+ // NB: The following step sets sanitizerInput to the built-in safe default configuration.
+ sanitizer_input = &built_in_safe_default_configuration();
+ }
+
+ // 6. Assert: sanitizerInput is either a Sanitizer instance, a SanitizerPresets member, or a SanitizerConfig
+ // dictionary.
+ // 7. If sanitizerInput is a string:
+ // 1. Assert: sanitizerInput is "default".
+ // 2. Set sanitizerInput to the built-in safe default configuration.
+ // NB: This was done above.
+
+ // 8. If sanitizerInput is a Sanitizer, then set sanitizerInput to sanitizerInput's configuration.
+ // 9. Assert: sanitizerInput is a dictionary.
+ auto clone = sanitizer_input.visit(
+ [](Empty) -> SanitizerConfiguration { VERIFY_NOT_REACHED(); },
+ [](GC::Ref<Sanitizer> sanitizer) { return sanitizer->configuration(); },
+ [](Bindings::SanitizerConfig const* config) { return canonicalize_sanitizer_config(*config); },
+ [](SanitizerConfiguration const* config) { return *config; });
+
+ // 10. Let sanitizer be a new Sanitizer object.
+ // 11. Let permissiveDefaults be true if safe is false; false otherwise.
+ auto permissive_defaults = safe ? PermissiveDefaults::No : PermissiveDefaults::Yes;
+
+ // 12. Configure sanitizer given sanitizerInput and permissiveDefaults.
+ // 13. Let configuration be sanitizer's configuration.
+ auto configuration = TRY(configure_sanitizer_configuration(move(clone), permissive_defaults));
+
+ // 14. If safe is true, then remove unsafe from configuration.
+ if (safe)
+ remove_unsafe_from_sanitizer_config(configuration);
+
+ // 15. Assert: configuration is valid.
+ VERIFY(sanitizer_configuration_is_valid(configuration));
+
+ // 16. Return configuration.
+ // NOTE: The returned SanitizerConfig is a fresh copy, so removing unsafe items from it never affects a Sanitizer
+ // object or SanitizerConfig dictionary that script can observe.
+ return Optional<SanitizerConfiguration> { move(configuration) };
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#get-a-sanitizer-from-dictionary
+// NB: The steps of "get a sanitizer from dictionary" after sanitizerInput has been found to be non-null.
+WebIDL::ExceptionOr<GC::Ref<Sanitizer>> get_a_sanitizer_from_sanitizer_input(SanitizerInput const& sanitizer_input)
+{
+ // 3. Let configuration be null.
+ auto configuration = sanitizer_input.visit(
+ // 4. If sanitizerInput is a SanitizerPresets:
+ [](Bindings::SanitizerPresets preset) {
+ // 1. Assert: sanitizerInput is "default".
+ VERIFY(preset == Bindings::SanitizerPresets::Default);
+
+ // 2. Set configuration to the built-in safe default configuration.
+ return built_in_safe_default_configuration();
+ },
+ // 5. Otherwise, if sanitizerInput is a Sanitizer:
+ // 1. Set configuration to sanitizerInput's configuration.
+ [](GC::Ref<Sanitizer> sanitizer) { return sanitizer->configuration(); },
+ // 6. Otherwise, if sanitizerInput is a SanitizerConfig:
+ // 1. Set configuration to sanitizerInput.
+ [](Bindings::SanitizerConfig const& config) { return canonicalize_sanitizer_config(config); });
+
+ // 7. Assert: configuration is not null.
+ // 8. Let sanitizer be a new Sanitizer in realm.
+ // 9. Configure sanitizer given configuration and true.
+ auto canonical_configuration = TRY(configure_sanitizer_configuration(move(configuration), PermissiveDefaults::Yes));
+
+ // 10. Return sanitizer.
+ return Sanitizer::create_with_configuration(move(canonical_configuration));
+}
+
+}
diff --git a/Libraries/LibWeb/HTML/SanitizerConfiguration.h b/Libraries/LibWeb/HTML/SanitizerConfiguration.h
new file mode 100644
index 00000000000..18755acfa07
--- /dev/null
+++ b/Libraries/LibWeb/HTML/SanitizerConfiguration.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Optional.h>
+#include <AK/Utf16FlyString.h>
+#include <AK/Utf16String.h>
+#include <AK/Variant.h>
+#include <AK/Vector.h>
+#include <LibGC/Ptr.h>
+#include <LibWeb/Export.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
+
+namespace Web::Bindings {
+
+enum class SanitizerPresets : u8;
+struct SanitizerConfig;
+struct SetHTMLOptions;
+struct SetHTMLUnsafeOptions;
+struct ParseHTMLUnsafeOptions;
+struct SanitizerElementNamespace;
+struct SanitizerElementNamespaceWithAttributes;
+struct SanitizerAttributeNamespace;
+struct SanitizerProcessingInstruction;
+
+}
+
+namespace Web::HTML {
+
+// NB: A canonicalized SanitizerElementNamespace or SanitizerAttributeNamespace dictionary.
+struct SanitizerName {
+ Utf16FlyString name;
+ Optional<Utf16FlyString> namespace_;
+
+ bool operator==(SanitizerName const&) const = default;
+};
+
+// NB: A canonicalized SanitizerElementNamespaceWithAttributes dictionary.
+struct SanitizerElementWithAttributes {
+ SanitizerName element;
+ Optional<Vector<SanitizerName>> attributes;
+ Optional<Vector<SanitizerName>> remove_attributes;
+
+ bool operator==(SanitizerElementWithAttributes const&) const = default;
+};
+
+// NB: A canonicalized SanitizerConfig dictionary. Processing instructions are represented by their target.
+struct SanitizerConfiguration {
+ Optional<Vector<SanitizerElementWithAttributes>> elements;
+ Optional<Vector<SanitizerName>> remove_elements;
+ Optional<Vector<SanitizerName>> replace_with_children_elements;
+ Optional<Vector<Utf16String>> processing_instructions;
+ Optional<Vector<Utf16String>> remove_processing_instructions;
+ Optional<Vector<SanitizerName>> attributes;
+ Optional<Vector<SanitizerName>> remove_attributes;
+ Optional<bool> comments;
+ Optional<bool> data_attributes;
+ Optional<bool> javascript_urls;
+};
+
+// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#sanitizer-action
+enum class SanitizerAction : u8 {
+ Keep,
+ Remove,
+ ReplaceWithChildren,
+};
+
+enum class PermissiveDefaults : u8 {
+ No,
+ Yes,
+};
+
+SanitizerConfiguration canonicalize_sanitizer_config(Bindings::SanitizerConfig const&);
+SanitizerName canonicalize_sanitizer_element(Variant<Utf16String, Bindings::SanitizerElementNamespace> const&);
+SanitizerElementWithAttributes canonicalize_sanitizer_element_with_attributes(Variant<Utf16String, Bindings::SanitizerElementNamespaceWithAttributes> const&);
+SanitizerName canonicalize_sanitizer_attribute(Variant<Utf16String, Bindings::SanitizerAttributeNamespace> const&);
+Utf16String canonicalize_sanitizer_processing_instruction(Variant<Utf16String, Bindings::SanitizerProcessingInstruction> const&);
+void canonicalize_the_configuration(SanitizerConfiguration&, PermissiveDefaults);
+bool sanitizer_configuration_is_valid(SanitizerConfiguration const&);
+WebIDL::ExceptionOr<SanitizerConfiguration> configure_sanitizer_configuration(SanitizerConfiguration, PermissiveDefaults);
+Bindings::SanitizerConfig sanitizer_configuration_to_bindings(SanitizerConfiguration const&);
+
+bool remove_an_element_from_sanitizer_config(SanitizerConfiguration&, SanitizerName const&);
+bool remove_an_attribute_from_sanitizer_config(SanitizerConfiguration&, SanitizerName const&);
+bool remove_unsafe_from_sanitizer_config(SanitizerConfiguration&);
+
+bool is_custom_data_attribute(SanitizerName const&);
+bool sanitizer_list_contains(Vector<SanitizerName> const&, SanitizerName const&);
+bool sanitizer_list_remove(Optional<Vector<SanitizerName>>&, SanitizerName const&);
+
+WEB_API bool sanitizer_config_allows_comments(SanitizerConfiguration const&);
+WEB_API bool sanitizer_config_allows_processing_instruction_target(Utf16View const& target, SanitizerConfiguration const&);
+WEB_API SanitizerAction sanitizer_action_for_element_name(Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_, SanitizerConfiguration const&);
+WEB_API bool sanitizer_config_allows_attribute(Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_, Utf16View const& value, Utf16FlyString const& element_local_name, Optional<Utf16FlyString> const& element_namespace, SanitizerConfiguration const&);
+
+SanitizerConfiguration const& built_in_safe_default_configuration();
+SanitizerConfiguration const& built_in_safe_baseline_configuration();
+bool built_in_non_replaceable_elements_list_contains(SanitizerName const&);
+
+enum class SanitizerSafety : u8 {
+ Unsafe,
+ Safe,
+};
+
+using SanitizerOptions = Variant<Bindings::SetHTMLOptions const*, Bindings::SetHTMLUnsafeOptions const*, Bindings::ParseHTMLUnsafeOptions const*, GC::Ref<TrustedTypes::TrustedHTMLParserOptions>>;
+
+WEB_API WebIDL::ExceptionOr<Optional<SanitizerConfiguration>> get_a_sanitizer_config_from_options(SanitizerOptions const&, SanitizerSafety);
+
+using SanitizerInput = Variant<GC::Ref<Sanitizer>, Bindings::SanitizerConfig, Bindings::SanitizerPresets>;
+WebIDL::ExceptionOr<GC::Ref<Sanitizer>> get_a_sanitizer_from_sanitizer_input(SanitizerInput const&);
+
+}
diff --git a/Libraries/LibWeb/TrustedTypes/BindingsGlue.h b/Libraries/LibWeb/TrustedTypes/BindingsGlue.h
index 47fdf253f0b..6b9704734e0 100644
--- a/Libraries/LibWeb/TrustedTypes/BindingsGlue.h
+++ b/Libraries/LibWeb/TrustedTypes/BindingsGlue.h
@@ -5,3 +5,16 @@
*/
#pragma once
+
+#include <LibJS/Runtime/Realm.h>
+#include <LibWeb/TrustedTypes/TrustedHTMLParserOptions.h>
+#include <LibWeb/TrustedTypes/TrustedTypePolicy.h>
+
+namespace Web::Bindings {
+
+inline WebIDL::ExceptionOr<GC::Ref<TrustedTypes::TrustedHTMLParserOptions>> create_parser_options(JS::Realm& realm, TrustedTypes::TrustedTypePolicy& policy, SetHTMLUnsafeOptions const& options, GC::RootVector<JS::Value> const& arguments)
+{
+ return policy.create_parser_options(realm.global_object(), options, arguments);
+}
+
+}
diff --git a/Libraries/LibWeb/TrustedTypes/InjectionSink.h b/Libraries/LibWeb/TrustedTypes/InjectionSink.h
index ff1834100d2..7de3936676a 100644
--- a/Libraries/LibWeb/TrustedTypes/InjectionSink.h
+++ b/Libraries/LibWeb/TrustedTypes/InjectionSink.h
@@ -22,9 +22,11 @@ namespace Web::TrustedTypes {
__ENUMERATE_INJECTION_SINKS(Document_writeln, "Document writeln") \
__ENUMERATE_INJECTION_SINKS(Document_execCommand, "Document execCommand") \
__ENUMERATE_INJECTION_SINKS(DOMParser_parseFromString, "DOMParser parseFromString") \
+ __ENUMERATE_INJECTION_SINKS(Element_appendHTMLUnsafe, "Element appendHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(Element_innerHTML, "Element innerHTML") \
__ENUMERATE_INJECTION_SINKS(Element_insertAdjacentHTML, "Element insertAdjacentHTML") \
__ENUMERATE_INJECTION_SINKS(Element_outerHTML, "Element outerHTML") \
+ __ENUMERATE_INJECTION_SINKS(Element_prependHTMLUnsafe, "Element prependHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(Element_setHTMLUnsafe, "Element setHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(Eval, "eval") \
__ENUMERATE_INJECTION_SINKS(Function, "Function") \
@@ -34,9 +36,14 @@ namespace Web::TrustedTypes {
__ENUMERATE_INJECTION_SINKS(HTMLScriptElement_text, "HTMLScriptElement text") \
__ENUMERATE_INJECTION_SINKS(HTMLScriptElement_textContent, "HTMLScriptElement textContent") \
__ENUMERATE_INJECTION_SINKS(Location_href, "Location href") \
+ __ENUMERATE_INJECTION_SINKS(Node_afterHTMLUnsafe, "Node afterHTMLUnsafe") \
+ __ENUMERATE_INJECTION_SINKS(Node_beforeHTMLUnsafe, "Node beforeHTMLUnsafe") \
+ __ENUMERATE_INJECTION_SINKS(Node_replaceWithHTMLUnsafe, "Node replaceWithHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(Range_createContextualFragment, "Range createContextualFragment") \
__ENUMERATE_INJECTION_SINKS(ServiceWorkerContainer_register, "ServiceWorkerContainer register") \
+ __ENUMERATE_INJECTION_SINKS(ShadowRoot_appendHTMLUnsafe, "ShadowRoot appendHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(ShadowRoot_innerHTML, "ShadowRoot innerHTML") \
+ __ENUMERATE_INJECTION_SINKS(ShadowRoot_prependHTMLUnsafe, "ShadowRoot prependHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(ShadowRoot_setHTMLUnsafe, "ShadowRoot setHTMLUnsafe") \
__ENUMERATE_INJECTION_SINKS(SharedWorker_constructor, "SharedWorker constructor") \
__ENUMERATE_INJECTION_SINKS(SVGScriptElement_href, "SVGScriptElement href") \
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.cpp b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.cpp
new file mode 100644
index 00000000000..07c1fea08d9
--- /dev/null
+++ b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibGC/Heap.h>
+#include <LibWeb/TrustedTypes/TrustedHTMLParserOptions.h>
+
+namespace Web::TrustedTypes {
+
+GC_DEFINE_ALLOCATOR(TrustedHTMLParserOptions);
+
+GC::Ref<TrustedHTMLParserOptions> TrustedHTMLParserOptions::create(Optional<HTML::SanitizerConfiguration> sanitizer_configuration, bool run_scripts)
+{
+ return GC::Heap::the().allocate<TrustedHTMLParserOptions>(move(sanitizer_configuration), run_scripts);
+}
+
+TrustedHTMLParserOptions::TrustedHTMLParserOptions(Optional<HTML::SanitizerConfiguration> sanitizer_configuration, bool run_scripts)
+ : m_sanitizer_configuration(move(sanitizer_configuration))
+ , m_run_scripts(run_scripts)
+{
+}
+
+TrustedHTMLParserOptions::~TrustedHTMLParserOptions() = default;
+
+}
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.h b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.h
new file mode 100644
index 00000000000..d86191f26d5
--- /dev/null
+++ b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Optional.h>
+#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/HTML/SanitizerConfiguration.h>
+
+namespace Web::TrustedTypes {
+
+// https://w3c.github.io/trusted-types/dist/spec/#trusted-html-parser-options
+class TrustedHTMLParserOptions final : public Bindings::GCAllocatedWrappable {
+ WEB_WRAPPABLE(TrustedHTMLParserOptions, Bindings::GCAllocatedWrappable);
+ GC_DECLARE_ALLOCATOR(TrustedHTMLParserOptions);
+
+public:
+ static GC::Ref<TrustedHTMLParserOptions> create(Optional<HTML::SanitizerConfiguration>, bool run_scripts);
+
+ virtual ~TrustedHTMLParserOptions() override;
+
+ bool run_scripts() const { return m_run_scripts; }
+ Optional<HTML::SanitizerConfiguration> const& sanitizer_configuration() const { return m_sanitizer_configuration; }
+
+private:
+ TrustedHTMLParserOptions(Optional<HTML::SanitizerConfiguration>, bool run_scripts);
+
+ // TrustedHTMLParserOptions objects have an associated boolean runScripts and an associated SanitizerConfig-or-null
+ // sanitizer configuration. These values are set when the object is created, and will never change during its
+ // lifetime.
+ Optional<HTML::SanitizerConfiguration> const m_sanitizer_configuration;
+ bool const m_run_scripts { false };
+};
+
+}
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.idl b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.idl
new file mode 100644
index 00000000000..0edcbfd2866
--- /dev/null
+++ b/Libraries/LibWeb/TrustedTypes/TrustedHTMLParserOptions.idl
@@ -0,0 +1,4 @@
+// https://w3c.github.io/trusted-types/dist/spec/#trusted-html-parser-options
+[Exposed=Window]
+interface TrustedHTMLParserOptions {
+};
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.cpp b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.cpp
index 3ab3157ee80..2253120a66b 100644
--- a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.cpp
+++ b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.cpp
@@ -9,8 +9,11 @@
#include <LibGC/Heap.h>
#include <LibGC/Ptr.h>
#include <LibJS/Runtime/Value.h>
+#include <LibWeb/Bindings/Sanitizer.h>
#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/Bindings/WrapperWorld.h>
#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/Sanitizer.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/TagNames.h>
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
@@ -18,6 +21,7 @@
#include <LibWeb/SVG/TagNames.h>
#include <LibWeb/TrustedTypes/RequireTrustedTypesForDirective.h>
#include <LibWeb/TrustedTypes/TrustedHTML.h>
+#include <LibWeb/TrustedTypes/TrustedHTMLParserOptions.h>
#include <LibWeb/TrustedTypes/TrustedScript.h>
#include <LibWeb/TrustedTypes/TrustedScriptURL.h>
#include <LibWeb/TrustedTypes/TrustedTypePolicyFactory.h>
@@ -34,6 +38,7 @@ TrustedTypePolicy::TrustedTypePolicy(Utf16String const& name, TrustedTypePolicyO
, m_create_html(options.create_html)
, m_create_script(options.create_script)
, m_create_script_url(options.create_script_url)
+ , m_create_parser_options(options.create_parser_options)
{
}
@@ -43,6 +48,7 @@ void TrustedTypePolicy::visit_edges(GC::Cell::Visitor& visitor)
visitor.visit(m_create_html);
visitor.visit(m_create_script);
visitor.visit(m_create_script_url);
+ visitor.visit(m_create_parser_options);
}
Utf16String to_string(TrustedTypeName trusted_type_name)
@@ -167,6 +173,279 @@ WebIDL::ExceptionOr<GC::Ref<TrustedScriptURL>> TrustedTypePolicy::create_script_
return trusted_type.get<GC::Ref<TrustedScriptURL>>();
}
+// https://w3c.github.io/trusted-types/dist/spec/#create-a-parser-options-callback-argument
+template<typename Options>
+static WebIDL::ExceptionOr<JS::Value> create_a_parser_options_callback_argument(JS::Object& global, Options const& dictionary)
+{
+ // 1. Let runScriptsInput be dictionary["runScripts"], with default false.
+ bool run_scripts_input = false;
+ if constexpr (requires { dictionary.run_scripts; })
+ run_scripts_input = dictionary.run_scripts;
+
+ // 2. Let argument be the ordered map «[ "runScripts" → runScriptsInput ]».
+ auto& realm = HTML::relevant_realm(global);
+ auto argument = JS::Object::create(realm, realm.intrinsics().object_prototype());
+ MUST(argument->create_data_property("runScripts"_utf16_fly_string, JS::Value(run_scripts_input)));
+
+ // 3. Let sanitizerInput be the result of getting a sanitizer from realm and dictionary.
+ // https://w3c.github.io/trusted-types/dist/spec/#get-a-sanitizer-from-dictionary
+ // 1. Let sanitizerInput be dictionary["sanitizer"], defaulting to null.
+ // 2. If sanitizerInput is null, return null.
+ // 4. If sanitizerInput is not null, set argument["sanitizer"] to sanitizerInput.
+ if (dictionary.sanitizer.has_value()) {
+ auto sanitizer = TRY(HTML::get_a_sanitizer_from_sanitizer_input(*dictionary.sanitizer));
+ auto wrapper = Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, sanitizer);
+ MUST(argument->create_data_property("sanitizer"_utf16_fly_string, wrapper));
+ }
+
+ // 5. Return argument.
+ return argument;
+}
+
+// NB: Converts the return value of a CreateParserOptionsCallback, whose return type is SetHTMLUnsafeOptions?, to an
+// IDL value.
+static WebIDL::ExceptionOr<Optional<Bindings::SetHTMLUnsafeOptions>> to_optional_set_html_unsafe_options(JS::VM& vm, JS::Value value)
+{
+ if (value.is_nullish())
+ return Optional<Bindings::SetHTMLUnsafeOptions> {};
+ return Optional<Bindings::SetHTMLUnsafeOptions> { TRY(Bindings::convert_to_idl_value_for_set_html_unsafe_options(vm, value)) };
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#get-a-sanitizer-config-copy-from-dictionary
+static WebIDL::ExceptionOr<Optional<HTML::SanitizerConfiguration>> get_a_sanitizer_config_copy_from_dictionary(Bindings::SetHTMLUnsafeOptions const& dictionary)
+{
+ // 1. Let sanitizer be the result of getting a sanitizer from realm and dictionary.
+ // 2. If sanitizer is null, return null.
+ if (!dictionary.sanitizer.has_value())
+ return Optional<HTML::SanitizerConfiguration> {};
+ auto sanitizer = TRY(HTML::get_a_sanitizer_from_sanitizer_input(*dictionary.sanitizer));
+
+ // 3. Return sanitizer's configuration.
+ return Optional<HTML::SanitizerConfiguration> { sanitizer->configuration() };
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createparseroptions
+WebIDL::ExceptionOr<GC::Ref<TrustedHTMLParserOptions>> TrustedTypePolicy::create_parser_options(JS::Object& global, Bindings::SetHTMLUnsafeOptions const& options, GC::RootVector<JS::Value> const& arguments)
+{
+ // Returns the result of executing the create a trusted type algorithm, with the following arguments:
+ // policy: this value
+ // trustedTypeName: "TrustedHTMLParserOptions"
+ // value: options
+ // arguments: arguments
+ // https://w3c.github.io/trusted-types/dist/spec/#create-a-trusted-type-algorithm
+ // 1. Let policyValue be the result of executing get trusted type policy value with the same arguments as this
+ // algorithm and additionally true as throwIfMissing.
+ // 2. If the algorithm threw an error, rethrow the error and abort the following steps.
+ auto policy_value = TRY(to_optional_set_html_unsafe_options(global.vm(), TRY(get_parser_options_policy_value(global, options, arguments, ThrowIfCallbackMissing::Yes))));
+
+ // 3. If trustedTypeName is "TrustedHTMLParserOptions":
+ // 1. If policyValue is null, throw a TypeError.
+ // NOTE: Returning null from a named policy's createParserOptions callback throws a TypeError here, whereas
+ // returning null or undefined from createHTML, createScript, or createScriptURL yields the empty string.
+ if (!policy_value.has_value())
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "createParserOptions returned null"_utf16 };
+
+ // 2. Let sanitizerConfig be the result of getting a sanitizer configuration from policy's relevant realm and
+ // policyValue.
+ auto sanitizer_config = TRY(get_a_sanitizer_config_copy_from_dictionary(*policy_value));
+
+ // 3. Let runScripts be policyValue["runScripts"] with default false.
+ auto run_scripts = policy_value->run_scripts;
+
+ // 4. Return a new instance of TrustedHTMLParserOptions in policy's relevant realm with its sanitizer configuration
+ // set to sanitizerConfig, and its runScripts set to runScripts.
+ return TrustedHTMLParserOptions::create(move(sanitizer_config), run_scripts);
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-policy-value
+// NB: The steps of "get trusted type policy value" for the "TrustedHTMLParserOptions" type name.
+template<typename Options>
+WebIDL::ExceptionOr<JS::Value> TrustedTypePolicy::get_parser_options_policy_value(JS::Object& global, Options const& value, GC::RootVector<JS::Value> const& arguments, ThrowIfCallbackMissing throw_if_missing)
+{
+ // 1. Let functionName be a function name for the given trustedTypeName, based on the following table:
+ // 2. Let function be policy's options[functionName].
+ auto function = m_create_parser_options;
+
+ // 3. If function is null, then:
+ if (!function) {
+ // 1. If throwIfMissing throw a TypeError.
+ if (throw_if_missing == ThrowIfCallbackMissing::Yes)
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Trying to create a trusted type without a callback"_utf16 };
+
+ // 2. Else return null.
+ return JS::js_null();
+ }
+
+ // 4. If trustedTypeName is "TrustedHTMLParserOptions":
+ // 1. Set value to the result of creating a parser options callback argument given policy's relevant realm and
+ // value.
+ auto argument = TRY(create_a_parser_options_callback_argument(global, value));
+
+ // 5. Let args be « value ».
+ GC::RootVector<JS::Value> args;
+ args.append(argument);
+
+ // 6. Append each item in arguments to args.
+ args.extend(arguments);
+
+ // 7. Let policyValue be the result of invoking function with args and "rethrow".
+ // 8. Return policyValue.
+ return TRY(invoke_trusted_type_policy_callback(*function, args));
+}
+
+// NB: A SetHTMLUnsafeOptions or ParseHTMLUnsafeOptions options needs vetting if options["runScripts"] exists and is
+// true, or if options["sanitizer"] exists and is not an empty SanitizerConfig.
+// https://w3c.github.io/trusted-types/dist/spec/#needs-vetting
+template<typename Options>
+static bool needs_vetting(Options const& options)
+{
+ if constexpr (requires { options.run_scripts; }) {
+ if (options.run_scripts)
+ return true;
+ }
+ if (!options.sanitizer.has_value())
+ return false;
+ // NOTE: An empty SanitizerConfig does not change the parsed markup.
+ auto const* config = options.sanitizer->template get_pointer<Bindings::SanitizerConfig>();
+ if (!config)
+ return true;
+ return config->elements.has_value() || config->remove_elements.has_value() || config->replace_with_children_elements.has_value()
+ || config->processing_instructions.has_value() || config->remove_processing_instructions.has_value()
+ || config->attributes.has_value() || config->remove_attributes.has_value() || config->comments.has_value()
+ || config->data_attributes.has_value() || config->javascript_ur_ls.has_value();
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-parser-options
+template<typename Options>
+WebIDL::ExceptionOr<CompliantParserOptions<Options>> get_trusted_type_compliant_parser_options(JS::Object& global, CompliantParserOptions<Options> const& input, ThrowIfCallbackMissing throw_if_missing, InjectionSink sink, OptionsFromAuthor options_from_author)
+{
+ // 1. If input is an instance of TrustedHTMLParserOptions, return input.
+ if (input.template has<GC::Ref<TrustedHTMLParserOptions>>())
+ return input;
+ auto const& options = input.template get<Options>();
+
+ // 2. Let requireTrustedTypes be the result of executing Does sink type require trusted types? algorithm, passing
+ // global, "script", and true.
+ auto require_trusted_types = does_sink_require_trusted_types(global, Script.view(), IncludeReportOnlyPolicies::Yes);
+
+ // 3. If requireTrustedTypes is false, return input.
+ if (!require_trusted_types)
+ return input;
+
+ // 4. Let requirePolicy be throwIfMissing.
+ bool require_policy = throw_if_missing == ThrowIfCallbackMissing::Yes;
+
+ // 5. If optionsFromAuthor is true and input needs vetting, set requirePolicy to true.
+ if (options_from_author == OptionsFromAuthor::Yes && needs_vetting(options))
+ require_policy = true;
+
+ auto reject_unless_allowed = [&]() -> WebIDL::ExceptionOr<CompliantParserOptions<Options>> {
+ // 1. Let disposition be the result of executing should sink type mismatch violation be blocked by content
+ // security policy? algorithm, passing global, sink, "script", and the empty string as source.
+ auto disposition = should_sink_type_mismatch_violation_be_blocked_by_content_security_policy(global, sink, Script.view(), {});
+
+ // 2. If disposition is "Allowed", return input.
+ if (disposition == ContentSecurityPolicy::Directives::Directive::Result::Allowed)
+ return input;
+
+ // 3. Throw a TypeError.
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, Utf16String::formatted("Sink {} requires parser options vetted by a Trusted Types policy", to_string(sink)) };
+ };
+
+ // 6. Let defaultPolicy be the value of global's trusted type policy factory's default policy.
+ auto* global_scope = HTML::window_or_worker_global_scope_from_global_object(global);
+ VERIFY(global_scope);
+ auto default_policy = global_scope->trusted_types()->default_policy();
+
+ // 7. If defaultPolicy is null:
+ if (!default_policy) {
+ // 1. If requirePolicy is true:
+ if (require_policy)
+ return reject_unless_allowed();
+
+ // 2. Return input.
+ return input;
+ }
+
+ // 8. Let function be defaultPolicy's options["createParserOptions"].
+ // 9. If function is null:
+ if (!default_policy->has_create_parser_options()) {
+ // 1. If requirePolicy is true:
+ if (require_policy)
+ return reject_unless_allowed();
+
+ // 2. Return input.
+ return input;
+ }
+
+ // 10. Let argument be the result of creating a parser options callback argument given global's relevant realm and
+ // input.
+ // 11. Let policyValue be the result of invoking function with « argument, "TrustedHTMLParserOptions", sink » and
+ // "rethrow".
+ // 12. If the algorithm threw an error, rethrow the error and abort the following steps.
+ auto& realm = HTML::relevant_realm(global);
+ auto& vm = realm.vm();
+ GC::RootVector<JS::Value> arguments;
+ arguments.append(JS::PrimitiveString::create(vm, "TrustedHTMLParserOptions"_utf16));
+ arguments.append(JS::PrimitiveString::create(vm, to_string(sink)));
+ auto policy_value = TRY(to_optional_set_html_unsafe_options(vm, TRY(default_policy->get_parser_options_policy_value(global, options, arguments, ThrowIfCallbackMissing::Yes))));
+
+ // 13. If policyValue is null or undefined:
+ if (!policy_value.has_value()) {
+ // NOTE: This step assures that the default policy rejection will be reported, but ignored in a report-only
+ // mode.
+ return reject_unless_allowed();
+ }
+
+ // 14. Let runScripts be policyValue["runScripts"], with default false.
+ // NOTE: When invoked as a default policy, the createParserOptions callback determines the final script execution
+ // behavior, overriding the caller's requested runScripts option.
+ auto run_scripts = policy_value->run_scripts;
+
+ // 15. Return a new TrustedHTMLParserOptions in global's relevant realm whose sanitizer configuration is set to the
+ // result of getting a sanitizer configuration from global's relevant realm and policyValue, and whose
+ // runScripts is set to runScripts.
+ auto sanitizer_config = TRY(get_a_sanitizer_config_copy_from_dictionary(*policy_value));
+ return CompliantParserOptions<Options> { TrustedHTMLParserOptions::create(move(sanitizer_config), run_scripts) };
+}
+
+// https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-input
+template<typename Options>
+WebIDL::ExceptionOr<CompliantInput<Options>> get_trusted_type_compliant_input(JS::Object& global, TrustedHTMLOrString const& input, CompliantParserOptions<Options> const& options, InjectionSink sink, DocumentType document_type, OptionsFromAuthor options_from_author)
+{
+ // 1. Let compliantOptions be options.
+ auto compliant_options = options;
+
+ // 2. If documentType is "html":
+ if (document_type == DocumentType::HTML) {
+ // 1. Set compliantOptions to the result of calling get trusted type compliant parser options, passing global,
+ // options, false, sink, and optionsFromAuthor.
+ // NOTE: Sinks that construct options themselves, rather than taking them from the author, pass false for
+ // optionsFromAuthor. For example, createContextualFragment() sets runScripts to true.
+ compliant_options = TRY(get_trusted_type_compliant_parser_options(global, options, ThrowIfCallbackMissing::No, sink, options_from_author));
+
+ // 2. If compliantOptions is an instance of TrustedHTMLParserOptions, return (stringified input,
+ // compliantOptions).
+ if (compliant_options.template has<GC::Ref<TrustedHTMLParserOptions>>()) {
+ auto stringified_input = input.visit(
+ [](GC::Ref<TrustedHTML> const& trusted_html) { return trusted_html->to_string(); },
+ [](Utf16String const& string) { return string; });
+ return CompliantInput<Options> { move(stringified_input), move(compliant_options) };
+ }
+ }
+
+ // 3. Let compliantHTML be the result of calling get trusted type compliant string, passing TrustedHTML, global,
+ // input, sink, and "script".
+ // 4. If the algorithm threw an error, rethrow the error.
+ auto compliant_html = TRY(get_trusted_type_compliant_string(TrustedTypeName::TrustedHTML, global, input, sink, Script.view()));
+
+ // 5. Return (compliantHTML, compliantOptions).
+ return CompliantInput<Options> { move(compliant_html), move(compliant_options) };
+}
+
+template WebIDL::ExceptionOr<CompliantInput<Bindings::SetHTMLUnsafeOptions>> get_trusted_type_compliant_input(JS::Object&, TrustedHTMLOrString const&, CompliantParserOptions<Bindings::SetHTMLUnsafeOptions> const&, InjectionSink, DocumentType, OptionsFromAuthor);
+template WebIDL::ExceptionOr<CompliantInput<Bindings::ParseHTMLUnsafeOptions>> get_trusted_type_compliant_input(JS::Object&, TrustedHTMLOrString const&, CompliantParserOptions<Bindings::ParseHTMLUnsafeOptions> const&, InjectionSink, DocumentType, OptionsFromAuthor);
+
// https://w3c.github.io/trusted-types/dist/spec/#create-a-trusted-type-algorithm
TrustedTypesVariants TrustedTypePolicy::create_a_trusted_type(JS::VM& vm, TrustedTypeName trusted_type_name, Utf16String const& value, GC::RootVector<JS::Value> const& arguments)
{
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h
index a37c8c08740..51b9098fa8a 100644
--- a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h
+++ b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.h
@@ -15,10 +15,20 @@
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Forward.h>
#include <LibWeb/TrustedTypes/InjectionSink.h>
+#include <LibWeb/TrustedTypes/TrustedHTML.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
+namespace Web::Bindings {
+
+struct ParseHTMLUnsafeOptions;
+struct SetHTMLUnsafeOptions;
+
+}
+
namespace Web::TrustedTypes {
+class TrustedHTMLParserOptions;
+
using TrustedTypePolicyOptions = Bindings::TrustedTypePolicyOptions;
// https://www.w3.org/TR/trusted-types/#typedefdef-trustedtype
@@ -54,6 +64,12 @@ public:
WebIDL::ExceptionOr<GC::Ref<TrustedHTML>> create_html(JS::VM&, Utf16String const&, GC::RootVector<JS::Value> const&);
WebIDL::ExceptionOr<GC::Ref<TrustedScript>> create_script(JS::VM&, Utf16String const&, GC::RootVector<JS::Value> const&);
WebIDL::ExceptionOr<GC::Ref<TrustedScriptURL>> create_script_url(JS::VM&, Utf16String const&, GC::RootVector<JS::Value> const&);
+ WebIDL::ExceptionOr<GC::Ref<TrustedHTMLParserOptions>> create_parser_options(JS::Object&, Bindings::SetHTMLUnsafeOptions const&, GC::RootVector<JS::Value> const&);
+
+ bool has_create_parser_options() const { return m_create_parser_options != nullptr; }
+
+ template<typename Options>
+ WebIDL::ExceptionOr<JS::Value> get_parser_options_policy_value(JS::Object&, Options const& value, GC::RootVector<JS::Value> const& arguments, ThrowIfCallbackMissing);
WebIDL::ExceptionOr<JS::Value> get_trusted_type_policy_value(JS::VM&, TrustedTypeName, Utf16String const& value, GC::RootVector<JS::Value> const& values, ThrowIfCallbackMissing throw_if_missing);
@@ -68,6 +84,7 @@ private:
GC::Ptr<WebIDL::CallbackType> const m_create_html;
GC::Ptr<WebIDL::CallbackType> const m_create_script;
GC::Ptr<WebIDL::CallbackType> const m_create_script_url;
+ GC::Ptr<WebIDL::CallbackType> const m_create_parser_options;
};
WebIDL::ExceptionOr<Optional<TrustedType>> process_value_with_a_default_policy(TrustedTypeName, JS::Object&, Variant<GC::Ref<TrustedHTML>, GC::Ref<TrustedScript>, GC::Ref<TrustedScriptURL>, Utf16String>, InjectionSink);
@@ -85,6 +102,31 @@ bool trusted_script_value_matches(JS::Value, StringView expected);
bool trusted_script_values_match(ReadonlySpan<JS::Value>, ReadonlySpan<String> expected);
JS::Completion invoke_trusted_type_policy_callback(WebIDL::CallbackType&, GC::RootVector<JS::Value> const& arguments);
+enum class DocumentType : u8 {
+ HTML,
+ XML,
+};
+
+enum class OptionsFromAuthor : u8 {
+ No,
+ Yes,
+};
+
+template<typename Options>
+using CompliantParserOptions = Variant<Options, GC::Ref<TrustedHTMLParserOptions>>;
+
+template<typename Options>
+struct CompliantInput {
+ Utf16String html;
+ CompliantParserOptions<Options> options;
+};
+
+template<typename Options>
+WebIDL::ExceptionOr<CompliantParserOptions<Options>> get_trusted_type_compliant_parser_options(JS::Object& global, CompliantParserOptions<Options> const& input, ThrowIfCallbackMissing, InjectionSink, OptionsFromAuthor = OptionsFromAuthor::Yes);
+
+template<typename Options>
+WebIDL::ExceptionOr<CompliantInput<Options>> get_trusted_type_compliant_input(JS::Object& global, TrustedHTMLOrString const& input, CompliantParserOptions<Options> const& options, InjectionSink, DocumentType = DocumentType::HTML, OptionsFromAuthor = OptionsFromAuthor::Yes);
+
// FIXME: Add-hoc definition of an element interface
struct ElementInterface {
Utf16String element_name;
diff --git a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.idl b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.idl
index d9356e35c70..16a90ca0db5 100644
--- a/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.idl
+++ b/Libraries/LibWeb/TrustedTypes/TrustedTypePolicy.idl
@@ -8,6 +8,7 @@ interface TrustedTypePolicy {
[NeedsCallerRealm] TrustedHTML createHTML(DOMString input, any... arguments);
[NeedsCallerRealm] TrustedScript createScript(DOMString input, any... arguments);
[NeedsCallerRealm] TrustedScriptURL createScriptURL(DOMString input, any... arguments);
+ [Exposed=Window, NeedsCallerRealm, ImplementedInBindings] TrustedHTMLParserOptions createParserOptions(optional SetHTMLUnsafeOptions options = {}, any... arguments);
};
// https://w3c.github.io/trusted-types/dist/spec/#trusted-type-policy-options
@@ -15,7 +16,9 @@ dictionary TrustedTypePolicyOptions {
CreateHTMLCallback createHTML;
CreateScriptCallback createScript;
CreateScriptURLCallback createScriptURL;
+ CreateParserOptionsCallback createParserOptions;
};
callback CreateHTMLCallback = DOMString? (DOMString input, any... arguments);
callback CreateScriptCallback = DOMString? (DOMString input, any... arguments);
callback CreateScriptURLCallback = USVString? (DOMString input, any... arguments);
+callback CreateParserOptionsCallback = SetHTMLUnsafeOptions? (SetHTMLUnsafeOptions options, any... arguments);
diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake
index 4bda606e214..0998c303f47 100644
--- a/Libraries/LibWeb/idl_files.cmake
+++ b/Libraries/LibWeb/idl_files.cmake
@@ -362,6 +362,7 @@ libweb_js_bindings(HTML/PopStateEvent)
libweb_js_bindings(HTML/PredefinedColorSpace)
libweb_js_bindings(HTML/PromiseRejectionEvent)
libweb_js_bindings(HTML/RadioNodeList)
+libweb_js_bindings(HTML/Sanitizer)
libweb_js_bindings(HTML/Scripting/Fetching)
libweb_js_bindings(HTML/SharedWorker)
libweb_js_bindings(HTML/SharedWorkerGlobalScope)
@@ -596,6 +597,7 @@ libweb_js_bindings(SVG/SVGURIReference)
libweb_js_bindings(SVG/SVGUseElement)
libweb_js_bindings(SVG/SVGViewElement)
libweb_js_bindings(TrustedTypes/TrustedHTML)
+libweb_js_bindings(TrustedTypes/TrustedHTMLParserOptions)
libweb_js_bindings(TrustedTypes/TrustedScript)
libweb_js_bindings(TrustedTypes/TrustedScriptURL)
libweb_js_bindings(TrustedTypes/TrustedTypePolicy)
diff --git a/Meta/Generators/libweb_bindings/glue_headers.py b/Meta/Generators/libweb_bindings/glue_headers.py
index 1903ac6f121..8f12b295503 100644
--- a/Meta/Generators/libweb_bindings/glue_headers.py
+++ b/Meta/Generators/libweb_bindings/glue_headers.py
@@ -27,7 +27,15 @@ def bindings_glue_header_for_interface(interface: Interface, wrapper_interface_n
if module == "CustomElements":
return "LibWeb/HTML/CustomElements/BindingsGlue.h"
- if name in ("Document", "Event", "EventTarget", "NodeIterator", "ShadowRoot", "TreeWalker"):
+ if name in (
+ "Document",
+ "Event",
+ "EventTarget",
+ "NodeIterator",
+ "NonDocumentTypeChildNode",
+ "ShadowRoot",
+ "TreeWalker",
+ ):
return "LibWeb/DOM/BindingsGlue.h"
if name == "WindowOrWorkerGlobalScope":
diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.ini
index 1e777922de0..385c4d7489e 100644
--- a/Tests/LibWeb/TestConfig.ini
+++ b/Tests/LibWeb/TestConfig.ini
@@ -1067,6 +1067,14 @@ Text/input/wpt-import/xhr/setrequestheader-content-type.htm
Text/input/wpt-import/xhr/split-byte-order-mark.any.html
Text/input/wpt-import/xhr/split-byte-order-mark.any.worker.html
+; These fetch their test cases from .sub.dat files.
+Text/input/wpt-import/sanitizer-api/sanitizer-in-adoption-agency.html
+Text/input/wpt-import/sanitizer-api/sanitizer-inert-document.html
+Text/input/wpt-import/sanitizer-api/sanitizer-script-tokenizer.html
+Text/input/wpt-import/sanitizer-api/sethtml-safety.html
+Text/input/wpt-import/sanitizer-api/sethtml-tree-construction.html
+Text/input/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.html
+
[Skipped]
; Needs vertical-rl inline geometry fidelity beyond the binary transpose
Ref/input/wpt-import/css/css-position/position-absolute-in-inline-006.html
diff --git a/Tests/LibWeb/Text/expected/HTML/Sanitizer-svg-event-handler-attributes.txt b/Tests/LibWeb/Text/expected/HTML/Sanitizer-svg-event-handler-attributes.txt
new file mode 100644
index 00000000000..1664ac3b801
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/Sanitizer-svg-event-handler-attributes.txt
@@ -0,0 +1,12 @@
+permissive, unsafe: animate dur,onbegin,onend,onrepeat
+permissive, safe: animate dur
+permissive, parseHTML: animate dur
+permissive, removeUnsafe: animate dur
+attribute allowlist, unsafe: animate dur,onbegin,onend,onrepeat
+attribute allowlist, safe: animate dur
+attribute allowlist, parseHTML: animate dur
+attribute allowlist, removeUnsafe: animate dur
+element attribute allowlist, unsafe: animate dur,onbegin,onend,onrepeat
+element attribute allowlist, safe: animate dur
+element attribute allowlist, parseHTML: animate dur
+element attribute allowlist, removeUnsafe: animate dur
diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt
index 1fb72072329..e312a12e47d 100644
--- a/Tests/LibWeb/Text/expected/all-window-properties.txt
+++ b/Tests/LibWeb/Text/expected/all-window-properties.txt
@@ -501,6 +501,7 @@ SVGTransformList
SVGUnitTypes
SVGUseElement
SVGViewElement
+Sanitizer
Screen
ScreenOrientation
ScriptProcessorNode
@@ -562,6 +563,7 @@ TransformStreamDefaultController
TransitionEvent
TreeWalker
TrustedHTML
+TrustedHTMLParserOptions
TrustedScript
TrustedScriptURL
TrustedTypePolicy
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/parsehtmlunsafe-with-trustedtypes.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/parsehtmlunsafe-with-trustedtypes.txt
index c6cda1a67d5..b15f44f5461 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/parsehtmlunsafe-with-trustedtypes.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/parsehtmlunsafe-with-trustedtypes.txt
@@ -2,11 +2,11 @@ Harness status: OK
Found 7 tests
-7 Fail
-Fail Document.parseHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Document.parseHTMLUnsafe: passing TrustedHTMLParserOptions directly works
-Fail Document.parseHTMLUnsafe: createParserOptions returning null fails
-Fail Document.parseHTMLUnsafe: createParserOptions returning undefined fails
-Fail Document.parseHTMLUnsafe: createParserOptions returning 0 fails
-Fail Document.parseHTMLUnsafe: createParserOptions returning 123 fails
-Fail Document.parseHTMLUnsafe: createParserOptions returning "foo" fails
\ No newline at end of file
+7 Pass
+Pass Document.parseHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Document.parseHTMLUnsafe: passing TrustedHTMLParserOptions directly works
+Pass Document.parseHTMLUnsafe: createParserOptions returning null fails
+Pass Document.parseHTMLUnsafe: createParserOptions returning undefined fails
+Pass Document.parseHTMLUnsafe: createParserOptions returning 0 fails
+Pass Document.parseHTMLUnsafe: createParserOptions returning 123 fails
+Pass Document.parseHTMLUnsafe: createParserOptions returning "foo" fails
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-base-immutable.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-base-immutable.txt
index fde9b806f8d..bff16c4caba 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-base-immutable.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-base-immutable.txt
@@ -2,32 +2,31 @@ Harness status: OK
Found 27 tests
-2 Pass
-25 Fail
-Fail Modifying a Sanitizer instance does not change subsequent new Sanitizer() instances
-Fail allowElement() on new Sanitizer() does not affect subsequent instances
-Fail removeElement() on new Sanitizer() does not affect subsequent instances
-Fail replaceElementWithChildren() on new Sanitizer() does not affect subsequent instances
-Fail allowAttribute() on new Sanitizer() does not affect subsequent instances
-Fail removeAttribute() on new Sanitizer() does not affect subsequent instances
-Fail allowProcessingInstruction() on new Sanitizer() does not affect subsequent instances
-Fail removeProcessingInstruction() on new Sanitizer() does not affect subsequent instances
-Fail setComments() on new Sanitizer() does not affect subsequent instances
-Fail setDataAttributes() on new Sanitizer() does not affect subsequent instances
-Fail removeUnsafe() on new Sanitizer() does not affect subsequent instances
-Fail Mutating the object returned by sanitizer.get() does not affect the Sanitizer or default configuration
-Fail Repeated calls to sanitizer.get() return distinct object copies
-Fail Modifying a Sanitizer after removeUnsafe() does not change the built-in safe baseline configuration
-Fail Mutating config returned from baseline sanitizer does not affect subsequent removeUnsafe() calls
-Fail Modifying input configuration dictionary after new Sanitizer(config) does not affect the Sanitizer
-Fail Sanitization with Element.prototype.setHTML() does not change default base configuration
+27 Pass
+Pass Modifying a Sanitizer instance does not change subsequent new Sanitizer() instances
+Pass allowElement() on new Sanitizer() does not affect subsequent instances
+Pass removeElement() on new Sanitizer() does not affect subsequent instances
+Pass replaceElementWithChildren() on new Sanitizer() does not affect subsequent instances
+Pass allowAttribute() on new Sanitizer() does not affect subsequent instances
+Pass removeAttribute() on new Sanitizer() does not affect subsequent instances
+Pass allowProcessingInstruction() on new Sanitizer() does not affect subsequent instances
+Pass removeProcessingInstruction() on new Sanitizer() does not affect subsequent instances
+Pass setComments() on new Sanitizer() does not affect subsequent instances
+Pass setDataAttributes() on new Sanitizer() does not affect subsequent instances
+Pass removeUnsafe() on new Sanitizer() does not affect subsequent instances
+Pass Mutating the object returned by sanitizer.get() does not affect the Sanitizer or default configuration
+Pass Repeated calls to sanitizer.get() return distinct object copies
+Pass Modifying a Sanitizer after removeUnsafe() does not change the built-in safe baseline configuration
+Pass Mutating config returned from baseline sanitizer does not affect subsequent removeUnsafe() calls
+Pass Modifying input configuration dictionary after new Sanitizer(config) does not affect the Sanitizer
+Pass Sanitization with Element.prototype.setHTML() does not change default base configuration
Pass Sanitization with Document.parseHTML() does not change default base configuration
-Fail A modified Sanitizer used in setHTML() does not affect default configuration or other Sanitizers
-Fail s.get() is unchanged after Element.prototype.setHTML() when Sanitizer has unsafe allowlist entries
-Fail s.get() is unchanged after Element.prototype.setHTML() when Sanitizer has unsafe remove-list configuration
+Pass A modified Sanitizer used in setHTML() does not affect default configuration or other Sanitizers
+Pass s.get() is unchanged after Element.prototype.setHTML() when Sanitizer has unsafe allowlist entries
+Pass s.get() is unchanged after Element.prototype.setHTML() when Sanitizer has unsafe remove-list configuration
Pass s.get() is unchanged after Document.parseHTML() when Sanitizer has unsafe entries
-Fail Sanitization with appendHTML() does not change default base configuration or mutate passed Sanitizer
-Fail Sanitization with prependHTML() does not change default base configuration or mutate passed Sanitizer
-Fail Sanitization with beforeHTML() does not change default base configuration or mutate passed Sanitizer
-Fail Sanitization with afterHTML() does not change default base configuration or mutate passed Sanitizer
-Fail Sanitization with replaceWithHTML() does not change default base configuration or mutate passed Sanitizer
\ No newline at end of file
+Pass Sanitization with appendHTML() does not change default base configuration or mutate passed Sanitizer
+Pass Sanitization with prependHTML() does not change default base configuration or mutate passed Sanitizer
+Pass Sanitization with beforeHTML() does not change default base configuration or mutate passed Sanitizer
+Pass Sanitization with afterHTML() does not change default base configuration or mutate passed Sanitizer
+Pass Sanitization with replaceWithHTML() does not change default base configuration or mutate passed Sanitizer
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-basic-filtering.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-basic-filtering.txt
index 52d563f6aa1..c3e1b169df5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-basic-filtering.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-basic-filtering.txt
@@ -1,22 +1,359 @@
-Harness status: Error
+Harness status: OK
-Found 16 tests
+Found 354 tests
-6 Pass
-10 Fail
-Fail setHTML testcase text/0, "text"
+354 Pass
+Pass setHTML testcase text/0, "text"
Pass setHTMLUnsafe testcase text/0, "text"
-Fail ShadowRoot.setHTML testcase text/0, "text"
+Pass ShadowRoot.setHTML testcase text/0, "text"
Pass ShadowRoot.setHTMLUnsafe testcase text/0, "text"
-Fail parseHTML testcase text/0, "text"
+Pass parseHTML testcase text/0, "text"
Pass parseHTMLUnsafe testcase text/0, "text"
-Fail setHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
+Pass setHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
Pass setHTMLUnsafe testcase elements/0, "<div><p>Hello <b>World!</b>"
-Fail ShadowRoot.setHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
Pass ShadowRoot.setHTMLUnsafe testcase elements/0, "<div><p>Hello <b>World!</b>"
-Fail parseHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
+Pass parseHTML testcase elements/0, "<div><p>Hello <b>World!</b>"
Pass parseHTMLUnsafe testcase elements/0, "<div><p>Hello <b>World!</b>"
-Fail setHTML testcase elements/1, "<div><p>Hello <b>World!</b>"
-Fail setHTMLUnsafe testcase elements/1, "<div><p>Hello <b>World!</b>"
-Fail ShadowRoot.setHTML testcase elements/1, "<div><p>Hello <b>World!</b>"
-Fail ShadowRoot.setHTMLUnsafe testcase elements/1, "<div><p>Hello <b>World!</b>"
\ No newline at end of file
+Pass setHTML testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass setHTMLUnsafe testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTML testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTMLUnsafe testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass parseHTML testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass parseHTMLUnsafe testcase elements/1, "<div><p>Hello <b>World!</b>"
+Pass setHTML testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass setHTMLUnsafe testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTML testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTMLUnsafe testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass parseHTML testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass parseHTMLUnsafe testcase elements/2, "<div><p>Hello <b>World!</b>"
+Pass setHTML testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass setHTMLUnsafe testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTML testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTMLUnsafe testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass parseHTML testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass parseHTMLUnsafe testcase elements/3, "<div><p>Hello <b>World!</b>"
+Pass setHTML testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass setHTMLUnsafe testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTML testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass ShadowRoot.setHTMLUnsafe testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass parseHTML testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass parseHTMLUnsafe testcase elements/4, "<div><p>Hello <b>World!</b>"
+Pass setHTML testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass setHTMLUnsafe testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTML testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTMLUnsafe testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTML testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTMLUnsafe testcase attributes/0, "<p id="hello" style="font-weight: bold">x"
+Pass setHTML testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass setHTMLUnsafe testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTML testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTMLUnsafe testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTML testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTMLUnsafe testcase attributes/1, "<p id="hello" style="font-weight: bold">x"
+Pass setHTML testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass setHTMLUnsafe testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTML testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass ShadowRoot.setHTMLUnsafe testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTML testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass parseHTMLUnsafe testcase attributes/2, "<p id="hello" style="font-weight: bold">x"
+Pass setHTML testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass setHTMLUnsafe testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass ShadowRoot.setHTML testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass ShadowRoot.setHTMLUnsafe testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass parseHTML testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass parseHTMLUnsafe testcase attributes-per-element/0, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass setHTML testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass setHTMLUnsafe testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass ShadowRoot.setHTML testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass ShadowRoot.setHTMLUnsafe testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass parseHTML testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass parseHTMLUnsafe testcase attributes-per-element/1, "<div style="font-weight: bold" class="bourgeoisie">"
+Pass setHTML testcase comments/0, "a <!-- comment --> b"
+Pass setHTMLUnsafe testcase comments/0, "a <!-- comment --> b"
+Pass ShadowRoot.setHTML testcase comments/0, "a <!-- comment --> b"
+Pass ShadowRoot.setHTMLUnsafe testcase comments/0, "a <!-- comment --> b"
+Pass parseHTML testcase comments/0, "a <!-- comment --> b"
+Pass parseHTMLUnsafe testcase comments/0, "a <!-- comment --> b"
+Pass setHTML testcase comments/1, "a <!-- comment --> b"
+Pass setHTMLUnsafe testcase comments/1, "a <!-- comment --> b"
+Pass ShadowRoot.setHTML testcase comments/1, "a <!-- comment --> b"
+Pass ShadowRoot.setHTMLUnsafe testcase comments/1, "a <!-- comment --> b"
+Pass parseHTML testcase comments/1, "a <!-- comment --> b"
+Pass parseHTMLUnsafe testcase comments/1, "a <!-- comment --> b"
+Pass setHTML testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTMLUnsafe testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTML testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTMLUnsafe testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTML testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTMLUnsafe testcase dataAttributes/0, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTML testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTMLUnsafe testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTML testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTMLUnsafe testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTML testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTMLUnsafe testcase dataAttributes/1, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTML testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTMLUnsafe testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTML testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass ShadowRoot.setHTMLUnsafe testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTML testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass parseHTMLUnsafe testcase dataAttributes/2, "<p data-x="1" data-y="2" data-z="3">"
+Pass setHTML testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass setHTMLUnsafe testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass ShadowRoot.setHTML testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass ShadowRoot.setHTMLUnsafe testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass parseHTML testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass parseHTMLUnsafe testcase dataAttributes/3, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass setHTML testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass setHTMLUnsafe testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass ShadowRoot.setHTML testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass ShadowRoot.setHTMLUnsafe testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass parseHTML testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass parseHTMLUnsafe testcase dataAttributes/4, "<div data-="x"></div>": "data-" prefix with an empty suffix is still covered by dataAttributes
+Pass setHTML testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass setHTMLUnsafe testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass ShadowRoot.setHTML testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass parseHTML testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass parseHTMLUnsafe testcase namespaces/0, "<svg><rect></svg><math><mi>x"
+Pass setHTML testcase namespaces/1, "<svg><rect>"
+Pass setHTMLUnsafe testcase namespaces/1, "<svg><rect>"
+Pass ShadowRoot.setHTML testcase namespaces/1, "<svg><rect>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/1, "<svg><rect>"
+Pass parseHTML testcase namespaces/1, "<svg><rect>"
+Pass parseHTMLUnsafe testcase namespaces/1, "<svg><rect>"
+Pass setHTML testcase namespaces/2, "<svg><rect>"
+Pass setHTMLUnsafe testcase namespaces/2, "<svg><rect>"
+Pass ShadowRoot.setHTML testcase namespaces/2, "<svg><rect>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/2, "<svg><rect>"
+Pass parseHTML testcase namespaces/2, "<svg><rect>"
+Pass parseHTMLUnsafe testcase namespaces/2, "<svg><rect>"
+Pass setHTML testcase namespaces/3, "<svg><rect>"
+Pass setHTMLUnsafe testcase namespaces/3, "<svg><rect>"
+Pass ShadowRoot.setHTML testcase namespaces/3, "<svg><rect>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/3, "<svg><rect>"
+Pass parseHTML testcase namespaces/3, "<svg><rect>"
+Pass parseHTMLUnsafe testcase namespaces/3, "<svg><rect>"
+Pass setHTML testcase namespaces/4, "<math><mi>x"
+Pass setHTMLUnsafe testcase namespaces/4, "<math><mi>x"
+Pass ShadowRoot.setHTML testcase namespaces/4, "<math><mi>x"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/4, "<math><mi>x"
+Pass parseHTML testcase namespaces/4, "<math><mi>x"
+Pass parseHTMLUnsafe testcase namespaces/4, "<math><mi>x"
+Pass setHTML testcase namespaces/5, "<math><mi>x"
+Pass setHTMLUnsafe testcase namespaces/5, "<math><mi>x"
+Pass ShadowRoot.setHTML testcase namespaces/5, "<math><mi>x"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/5, "<math><mi>x"
+Pass parseHTML testcase namespaces/5, "<math><mi>x"
+Pass parseHTMLUnsafe testcase namespaces/5, "<math><mi>x"
+Pass setHTML testcase namespaces/6, "<math><mi>x"
+Pass setHTMLUnsafe testcase namespaces/6, "<math><mi>x"
+Pass ShadowRoot.setHTML testcase namespaces/6, "<math><mi>x"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/6, "<math><mi>x"
+Pass parseHTML testcase namespaces/6, "<math><mi>x"
+Pass parseHTMLUnsafe testcase namespaces/6, "<math><mi>x"
+Pass setHTML testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTMLUnsafe testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTML testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTML testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTMLUnsafe testcase namespaces/7, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTML testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTMLUnsafe testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTML testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTML testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTMLUnsafe testcase namespaces/8, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTML testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTMLUnsafe testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTML testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTML testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass parseHTMLUnsafe testcase namespaces/9, "<svg xml:space="default" xlink:href="about:blank" xmlns:foo="barspace">"
+Pass setHTML testcase namespaces/10, "<svg>Hello</svg>"
+Pass setHTMLUnsafe testcase namespaces/10, "<svg>Hello</svg>"
+Pass ShadowRoot.setHTML testcase namespaces/10, "<svg>Hello</svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/10, "<svg>Hello</svg>"
+Pass parseHTML testcase namespaces/10, "<svg>Hello</svg>"
+Pass parseHTMLUnsafe testcase namespaces/10, "<svg>Hello</svg>"
+Pass setHTML testcase namespaces/11, "<svg>Hello</svg>"
+Pass setHTMLUnsafe testcase namespaces/11, "<svg>Hello</svg>"
+Pass ShadowRoot.setHTML testcase namespaces/11, "<svg>Hello</svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/11, "<svg>Hello</svg>"
+Pass parseHTML testcase namespaces/11, "<svg>Hello</svg>"
+Pass parseHTMLUnsafe testcase namespaces/11, "<svg>Hello</svg>"
+Pass setHTML testcase namespaces/12, "<math>Hello</math>"
+Pass setHTMLUnsafe testcase namespaces/12, "<math>Hello</math>"
+Pass ShadowRoot.setHTML testcase namespaces/12, "<math>Hello</math>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/12, "<math>Hello</math>"
+Pass parseHTML testcase namespaces/12, "<math>Hello</math>"
+Pass parseHTMLUnsafe testcase namespaces/12, "<math>Hello</math>"
+Pass setHTML testcase namespaces/13, "<math>Hello</math>"
+Pass setHTMLUnsafe testcase namespaces/13, "<math>Hello</math>"
+Pass ShadowRoot.setHTML testcase namespaces/13, "<math>Hello</math>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/13, "<math>Hello</math>"
+Pass parseHTML testcase namespaces/13, "<math>Hello</math>"
+Pass parseHTMLUnsafe testcase namespaces/13, "<math>Hello</math>"
+Pass setHTML testcase namespaces/14, "<math>Hello</math>"
+Pass setHTMLUnsafe testcase namespaces/14, "<math>Hello</math>"
+Pass ShadowRoot.setHTML testcase namespaces/14, "<math>Hello</math>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/14, "<math>Hello</math>"
+Pass parseHTML testcase namespaces/14, "<math>Hello</math>"
+Pass parseHTMLUnsafe testcase namespaces/14, "<math>Hello</math>"
+Pass setHTML testcase namespaces/15, "<p style="bla"></p>"
+Pass setHTMLUnsafe testcase namespaces/15, "<p style="bla"></p>"
+Pass ShadowRoot.setHTML testcase namespaces/15, "<p style="bla"></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/15, "<p style="bla"></p>"
+Pass parseHTML testcase namespaces/15, "<p style="bla"></p>"
+Pass parseHTMLUnsafe testcase namespaces/15, "<p style="bla"></p>"
+Pass setHTML testcase namespaces/16, "<p href="bla"></p>"
+Pass setHTMLUnsafe testcase namespaces/16, "<p href="bla"></p>"
+Pass ShadowRoot.setHTML testcase namespaces/16, "<p href="bla"></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase namespaces/16, "<p href="bla"></p>"
+Pass parseHTML testcase namespaces/16, "<p href="bla"></p>"
+Pass parseHTMLUnsafe testcase namespaces/16, "<p href="bla"></p>"
+Pass setHTML testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass setHTMLUnsafe testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass ShadowRoot.setHTML testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass parseHTML testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass parseHTMLUnsafe testcase xlink-href-html-content/0, "<p xlink:href="bla"></p>"
+Pass setHTML testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass setHTMLUnsafe testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass ShadowRoot.setHTML testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass parseHTML testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass parseHTMLUnsafe testcase xlink-href-html-content/1, "<p xlink:href="bla"></p>"
+Pass setHTML testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass setHTMLUnsafe testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass ShadowRoot.setHTML testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass parseHTML testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass parseHTMLUnsafe testcase xlink-href-html-content/2, "<p href='bla'></p>"
+Pass setHTML testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass setHTMLUnsafe testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass ShadowRoot.setHTML testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass parseHTML testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass parseHTMLUnsafe testcase xlink-href-html-content/3, "<p xlink:href='bla'></p>"
+Pass setHTML testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass setHTMLUnsafe testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass ShadowRoot.setHTML testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass parseHTML testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass parseHTMLUnsafe testcase xlink-href-foreign-content/0, "<svg xlink:href="bla"></svg>"
+Pass setHTML testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass setHTMLUnsafe testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass ShadowRoot.setHTML testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass parseHTML testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass parseHTMLUnsafe testcase xlink-href-foreign-content/1, "<svg xlink:href="bla"></svg>"
+Pass setHTML testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass setHTMLUnsafe testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass ShadowRoot.setHTML testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass parseHTML testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass parseHTMLUnsafe testcase xlink-href-foreign-content/2, "<svg href='bla'></svg>"
+Pass setHTML testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass setHTMLUnsafe testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass ShadowRoot.setHTML testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass parseHTML testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass parseHTMLUnsafe testcase xlink-href-foreign-content/3, "<svg xlink:href='bla'></svg>"
+Pass setHTML testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass setHTMLUnsafe testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass ShadowRoot.setHTML testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass ShadowRoot.setHTMLUnsafe testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass parseHTML testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass parseHTMLUnsafe testcase xlink-href-foreign-content/4, "<svg><a xlink:href="bla"></a></svg>": Namespaced attribute xlink:href inside SVG tree
+Pass setHTML testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass setHTMLUnsafe testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass ShadowRoot.setHTML testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass ShadowRoot.setHTMLUnsafe testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass parseHTML testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass parseHTMLUnsafe testcase defaults-with-attributes-per-element/0, "<div start=1 value=5 lang=en><ol start=1 value=5 lang=en><li start=1 value=5 lang=en>xx"
+Pass setHTML testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass setHTMLUnsafe testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTML testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass parseHTML testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass parseHTMLUnsafe testcase mixed-case-element-names/0, "<svg><feBlend></feBlend></svg>"
+Pass setHTML testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass setHTMLUnsafe testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass ShadowRoot.setHTML testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass parseHTML testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass parseHTMLUnsafe testcase mixed-case-element-names/1, "<svg><feColorMatrix></feColorMatrix></svg>"
+Pass setHTML testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass setHTMLUnsafe testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass ShadowRoot.setHTML testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass parseHTML testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass parseHTMLUnsafe testcase mixed-case-element-names/2, "<svg><textPath></textPath></svg>"
+Pass setHTML testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass setHTMLUnsafe testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass ShadowRoot.setHTML testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass ShadowRoot.setHTMLUnsafe testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass parseHTML testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass parseHTMLUnsafe testcase element-name-case-mismatch/0, "<div>text</div>"
+Pass setHTML testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass setHTMLUnsafe testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTML testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass parseHTML testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass parseHTMLUnsafe testcase element-name-case-mismatch/1, "<svg><feBlend></feBlend></svg>"
+Pass setHTML testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass setHTMLUnsafe testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTML testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass parseHTML testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass parseHTMLUnsafe testcase element-name-case-mismatch/2, "<svg><feBlend></feBlend></svg>"
+Pass setHTML testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTMLUnsafe testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTML testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTML testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTMLUnsafe testcase adjusted-svg-attribute-names/0, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTML testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTMLUnsafe testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTML testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTML testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTMLUnsafe testcase adjusted-svg-attribute-names/1, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTML testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTMLUnsafe testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTML testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass ShadowRoot.setHTMLUnsafe testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTML testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass parseHTMLUnsafe testcase adjusted-svg-attribute-names/2, "<svg><marker viewbox="0 0 1 1"></marker></svg>"
+Pass setHTML testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass setHTMLUnsafe testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass ShadowRoot.setHTML testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass ShadowRoot.setHTMLUnsafe testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass parseHTML testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass parseHTMLUnsafe testcase adjusted-svg-attribute-names/3, "<svg><marker viewbox="0 0 1 1" refx="1" markerwidth="2"></marker></svg>": Default config keeps case-adjusted SVG attribute names
+Pass setHTML testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass setHTMLUnsafe testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass ShadowRoot.setHTML testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass ShadowRoot.setHTMLUnsafe testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass parseHTML testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass parseHTMLUnsafe testcase unknown/0, "<hello><world>": Unknown element names get blocked without being allowed.
+Pass setHTML testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass setHTMLUnsafe testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass ShadowRoot.setHTML testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass ShadowRoot.setHTMLUnsafe testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass parseHTML testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass parseHTMLUnsafe testcase unknown/1, "<hello><world>": Unknown element names pass when allowed.
+Pass setHTML testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass setHTMLUnsafe testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass ShadowRoot.setHTML testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass ShadowRoot.setHTMLUnsafe testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass parseHTML testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass parseHTMLUnsafe testcase unknown/2, "<b hello='1' world>": Unknown attribute names get blocked without being allowed.
+Pass setHTML testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
+Pass setHTMLUnsafe testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
+Pass ShadowRoot.setHTML testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
+Pass ShadowRoot.setHTMLUnsafe testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
+Pass parseHTML testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
+Pass parseHTMLUnsafe testcase unknown/3, "<b hello='1' world>": Unknown attribute names pass when allowed.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-boolean-defaults.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-boolean-defaults.txt
index 41e8068b714..c0005fe4542 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-boolean-defaults.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-boolean-defaults.txt
@@ -2,7 +2,7 @@ Harness status: OK
Found 3 tests
-3 Fail
-Fail comments
-Fail data attributes
-Fail javascript URLs
\ No newline at end of file
+3 Pass
+Pass comments
+Pass data attributes
+Pass javascript URLs
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-config.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-config.txt
index 597e278e762..4536a80710b 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-config.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-config.txt
@@ -2,76 +2,76 @@ Harness status: OK
Found 72 tests
-72 Fail
-Fail Sanitizer constructor without config.
-Fail Sanitizer constructor with empty config.
-Fail Sanitizer constructor with null as config.
-Fail Sanitizer constructor with undefined as config.
-Fail Sanitizer constructor with config ignore unknown values.
-Fail SanitizerConfig comments field.
-Fail SanitizerConfig dataAttributes field.
-Fail SanitizerConfig javascriptURLs field.
-Fail SanitizerConfig, normalization: elements: ["div"]
-Fail SanitizerConfig, normalization: elements: [{"name":"b"}]
-Fail SanitizerConfig, normalization: elements: [{"name":"b","namespace":null}]
-Fail SanitizerConfig, normalization: elements: [{"name":"b","namespace":""}]
-Fail SanitizerConfig, normalization: elements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
-Fail SanitizerConfig, normalization: elements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
-Fail SanitizerConfig, normalization: removeElements: ["div"]
-Fail SanitizerConfig, normalization: removeElements: [{"name":"b"}]
-Fail SanitizerConfig, normalization: removeElements: [{"name":"b","namespace":null}]
-Fail SanitizerConfig, normalization: removeElements: [{"name":"b","namespace":""}]
-Fail SanitizerConfig, normalization: removeElements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
-Fail SanitizerConfig, normalization: removeElements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: ["div"]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b"}]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b","namespace":null}]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b","namespace":""}]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
-Fail SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
-Fail SanitizerConfig, normalization: processingInstructions: ["target-1"]
-Fail SanitizerConfig, normalization: processingInstructions: [{"target":"target-1"}]
-Fail SanitizerConfig, normalization: removeProcessingInstructions: ["target-1"]
-Fail SanitizerConfig, normalization: removeProcessingInstructions: [{"target":"target-1"}]
-Fail SanitizerConfig, normalization: attributes: ["href"]
-Fail SanitizerConfig, normalization: attributes: [{"name":"href","namespace":null}]
-Fail SanitizerConfig, normalization: attributes: [{"name":"href","namespace":""}]
-Fail SanitizerConfig, normalization: attributes: [{"name":"href","namespace":"https://www.w3.org/1999/xlink"}]
-Fail SanitizerConfig, normalization: removeAttributes: ["href"]
-Fail SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":null}]
-Fail SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":""}]
-Fail SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":"https://www.w3.org/1999/xlink"}]
-Fail Test elements addition.
-Fail Test elements removal.
-Fail Test elements replacewithchildren.
-Fail Test processingInstructions addition.
-Fail Test processingInstructions removal.
-Fail Test attribute addition.
-Fail Test attribute removal.
-Fail Test attribute-per-element sets (i.e. overwrites).
-Fail Test removeAttribute-per-element sets (i.e. overwrites).
-Fail Both elements and removeElements should not be allowed.
-Fail Both attributes and removeAttributes should not be allowed.
-Fail Both processingInstructions and removeProcessingInstructions should not be allowed.
-Fail config[elements] should not allow duplicates
-Fail config[removeElements] should not allow duplicates
-Fail config[replaceWithChildrenElements] should not allow duplicates
-Fail config[attributes] should not allow duplicates
-Fail config[removeAttributes] should not allow duplicates
-Fail config[processingInstructions] should not allow duplicate targets
-Fail config[removeProcessingInstructions] should not allow duplicate targets
-Fail config[replaceWithChildrenElements] should not allow non-replaceable elements
-Fail config[elements] and config[replaceWithChildrenElements] should not intersect
-Fail config[removeElements] and config[replaceWithChildrenElements] should not intersect
-Fail Duplicates in element[attributes] with config[attributes] should not be allowed.
-Fail Duplicates in element[removeAttributes] with config[attributes] should not be allowed.
-Fail config[attributes] and element[attributes] should not intersect.
-Fail element[removeAttributes] should be a subset of config[attributes]
-Fail element[attributes] with a data attribute must not co-exist with config[dataAttributes] set to true.
-Fail config[attributes] with a data attribute must not co-exist with config[dataAttributes] set to true.
-Fail element[attributes] and element[removeAttributes] should not both exist with config[removeAttributes].
-Fail Duplicates in element[attributes] with config[removeAttributes] should not be allowed.
-Fail Duplicates in element[removeAttributes] with config[removeAttributes] should not be allowed.
-Fail config[removeAttributes] and element[attributes] should not intersect.
-Fail config[removeAttributes] and element[removeAttributes] should not intersect.
-Fail Can not use config[dataAttributes] and config[removeAttributes] together.
\ No newline at end of file
+72 Pass
+Pass Sanitizer constructor without config.
+Pass Sanitizer constructor with empty config.
+Pass Sanitizer constructor with null as config.
+Pass Sanitizer constructor with undefined as config.
+Pass Sanitizer constructor with config ignore unknown values.
+Pass SanitizerConfig comments field.
+Pass SanitizerConfig dataAttributes field.
+Pass SanitizerConfig javascriptURLs field.
+Pass SanitizerConfig, normalization: elements: ["div"]
+Pass SanitizerConfig, normalization: elements: [{"name":"b"}]
+Pass SanitizerConfig, normalization: elements: [{"name":"b","namespace":null}]
+Pass SanitizerConfig, normalization: elements: [{"name":"b","namespace":""}]
+Pass SanitizerConfig, normalization: elements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
+Pass SanitizerConfig, normalization: elements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
+Pass SanitizerConfig, normalization: removeElements: ["div"]
+Pass SanitizerConfig, normalization: removeElements: [{"name":"b"}]
+Pass SanitizerConfig, normalization: removeElements: [{"name":"b","namespace":null}]
+Pass SanitizerConfig, normalization: removeElements: [{"name":"b","namespace":""}]
+Pass SanitizerConfig, normalization: removeElements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
+Pass SanitizerConfig, normalization: removeElements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: ["div"]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b"}]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b","namespace":null}]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"b","namespace":""}]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"p","namespace":"http://www.w3.org/1999/xhtml"}]
+Pass SanitizerConfig, normalization: replaceWithChildrenElements: [{"name":"bla","namespace":"http://fantasy.org/namespace"}]
+Pass SanitizerConfig, normalization: processingInstructions: ["target-1"]
+Pass SanitizerConfig, normalization: processingInstructions: [{"target":"target-1"}]
+Pass SanitizerConfig, normalization: removeProcessingInstructions: ["target-1"]
+Pass SanitizerConfig, normalization: removeProcessingInstructions: [{"target":"target-1"}]
+Pass SanitizerConfig, normalization: attributes: ["href"]
+Pass SanitizerConfig, normalization: attributes: [{"name":"href","namespace":null}]
+Pass SanitizerConfig, normalization: attributes: [{"name":"href","namespace":""}]
+Pass SanitizerConfig, normalization: attributes: [{"name":"href","namespace":"https://www.w3.org/1999/xlink"}]
+Pass SanitizerConfig, normalization: removeAttributes: ["href"]
+Pass SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":null}]
+Pass SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":""}]
+Pass SanitizerConfig, normalization: removeAttributes: [{"name":"href","namespace":"https://www.w3.org/1999/xlink"}]
+Pass Test elements addition.
+Pass Test elements removal.
+Pass Test elements replacewithchildren.
+Pass Test processingInstructions addition.
+Pass Test processingInstructions removal.
+Pass Test attribute addition.
+Pass Test attribute removal.
+Pass Test attribute-per-element sets (i.e. overwrites).
+Pass Test removeAttribute-per-element sets (i.e. overwrites).
+Pass Both elements and removeElements should not be allowed.
+Pass Both attributes and removeAttributes should not be allowed.
+Pass Both processingInstructions and removeProcessingInstructions should not be allowed.
+Pass config[elements] should not allow duplicates
+Pass config[removeElements] should not allow duplicates
+Pass config[replaceWithChildrenElements] should not allow duplicates
+Pass config[attributes] should not allow duplicates
+Pass config[removeAttributes] should not allow duplicates
+Pass config[processingInstructions] should not allow duplicate targets
+Pass config[removeProcessingInstructions] should not allow duplicate targets
+Pass config[replaceWithChildrenElements] should not allow non-replaceable elements
+Pass config[elements] and config[replaceWithChildrenElements] should not intersect
+Pass config[removeElements] and config[replaceWithChildrenElements] should not intersect
+Pass Duplicates in element[attributes] with config[attributes] should not be allowed.
+Pass Duplicates in element[removeAttributes] with config[attributes] should not be allowed.
+Pass config[attributes] and element[attributes] should not intersect.
+Pass element[removeAttributes] should be a subset of config[attributes]
+Pass element[attributes] with a data attribute must not co-exist with config[dataAttributes] set to true.
+Pass config[attributes] with a data attribute must not co-exist with config[dataAttributes] set to true.
+Pass element[attributes] and element[removeAttributes] should not both exist with config[removeAttributes].
+Pass Duplicates in element[attributes] with config[removeAttributes] should not be allowed.
+Pass Duplicates in element[removeAttributes] with config[removeAttributes] should not be allowed.
+Pass config[removeAttributes] and element[attributes] should not intersect.
+Pass config[removeAttributes] and element[removeAttributes] should not intersect.
+Pass Can not use config[dataAttributes] and config[removeAttributes] together.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-constructor.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-constructor.txt
index 2f260a7666e..813b4fd8fe0 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-constructor.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-constructor.txt
@@ -2,19 +2,18 @@ Harness status: OK
Found 14 tests
-1 Pass
-13 Fail
-Fail setHTML blocks CE constructor when element is dropped by explicit sanitizer config (removeElements)
-Fail setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (removeElements)
-Fail setHTML blocks CE constructor when element is dropped by explicit sanitizer config (allowElements)
-Fail setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (allowElements)
-Fail setHTML blocks CE constructor when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
-Fail setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
-Fail setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (removeElements)
-Fail setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (removeElements)
-Fail setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (allowElements)
-Fail setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (allowElements)
-Fail setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
-Fail setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
-Fail setHTML constructs an allowed CE from the scoped registry
+14 Pass
+Pass setHTML blocks CE constructor when element is dropped by explicit sanitizer config (removeElements)
+Pass setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (removeElements)
+Pass setHTML blocks CE constructor when element is dropped by explicit sanitizer config (allowElements)
+Pass setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (allowElements)
+Pass setHTML blocks CE constructor when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
+Pass setHTML blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
+Pass setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (removeElements)
+Pass setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (removeElements)
+Pass setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (allowElements)
+Pass setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (allowElements)
+Pass setHTMLUnsafe blocks CE constructor when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
+Pass setHTMLUnsafe blocks CE constructor in scoped registry when element is dropped by explicit sanitizer config (replaceWithChildrenElements)
+Pass setHTML constructs an allowed CE from the scoped registry
Pass setHTMLUnsafe constructs an allowed CE from the scoped registry
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-is.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-is.txt
index 533408355be..1957186f8a7 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-is.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-custom-elements-is.txt
@@ -2,12 +2,12 @@ Harness status: OK
Found 8 tests
-8 Fail
-Fail The is= attribute is removed by the default sanitizer config.
-Fail The is= attribute is removed by the global removeAttributes
-Fail The is= attribute is removed by the local removeAttributes
-Fail The is= attribute is removed by the local missing attributes
-Fail The is= attribute is kept when allowed with an empty config.
-Fail The is= attribute is kept when allowed by global attributes.
-Fail The is= attribute is kept when allowed by global removeAttributes.
-Fail The is= attribute is kept when allowed by local attributes.
\ No newline at end of file
+8 Pass
+Pass The is= attribute is removed by the default sanitizer config.
+Pass The is= attribute is removed by the global removeAttributes
+Pass The is= attribute is removed by the local removeAttributes
+Pass The is= attribute is removed by the local missing attributes
+Pass The is= attribute is kept when allowed with an empty config.
+Pass The is= attribute is kept when allowed by global attributes.
+Pass The is= attribute is kept when allowed by global removeAttributes.
+Pass The is= attribute is kept when allowed by local attributes.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-duplicate-html-body.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-duplicate-html-body.txt
index d84b48f86c2..69dc03eb501 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-duplicate-html-body.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-duplicate-html-body.txt
@@ -2,16 +2,16 @@ Harness status: OK
Found 12 tests
-12 Fail
-Fail Document.parseHTML testcase 0, "<body><body onload="alert(1)" onclick="alert(2)" class="safe-body" data-test="val"></body>"
-Fail Document.parseHTML testcase 1, "<body id="initial" class="initial"><body id="duplicate" class="duplicate" dir="rtl" onclick="alert(1)"></body>"
-Fail Document.parseHTML testcase 2, "<html lang="en" id="root"><html id="duplicate" dir="rtl" onclick="alert(1)"><body></body>"
-Fail Document.parseHTML testcase 3, "<body><body class="allowed" title="forbidden"></body>"
-Fail Document.parseHTML testcase 4, "<html lang="en" dir="ltr" class="html-cls"><body id="main" class="body-cls" dir="ltr"></body>"
-Fail Document.parseHTML testcase 5, "<html><body><body class="body-cls" data-foo="bar"></body>"
-Fail Document.parseHTMLUnsafe testcase 0, "<body><body data-bad="strip-me" data-good="keep-me"></body>"
-Fail Document.parseHTMLUnsafe testcase 1, "<html data-bad-html="1" data-good-html="2"><body data-bad-body="3" data-good-body="4"></body>"
-Fail Document.parseHTMLUnsafe testcase 2, "<html><body><html data-dup-bad-html="1" data-dup-good-html="2"><body data-dup-bad-body="3" data-dup-good-body="4"></body>"
-Fail Document.parseHTMLUnsafe testcase 3, "<html title="html-title"><body title="body-title"><div title="div-title"></div></body>"
-Fail Fragment setHTML testcase 0, "<body id="test-body" onclick="alert(1)" class="safe-body"></body>"
-Fail Fragment setHTML testcase 1, "<body id="first" class="first"><body id="second" dir="rtl" onclick="alert(1)"></body>"
\ No newline at end of file
+12 Pass
+Pass Document.parseHTML testcase 0, "<body><body onload="alert(1)" onclick="alert(2)" class="safe-body" data-test="val"></body>"
+Pass Document.parseHTML testcase 1, "<body id="initial" class="initial"><body id="duplicate" class="duplicate" dir="rtl" onclick="alert(1)"></body>"
+Pass Document.parseHTML testcase 2, "<html lang="en" id="root"><html id="duplicate" dir="rtl" onclick="alert(1)"><body></body>"
+Pass Document.parseHTML testcase 3, "<body><body class="allowed" title="forbidden"></body>"
+Pass Document.parseHTML testcase 4, "<html lang="en" dir="ltr" class="html-cls"><body id="main" class="body-cls" dir="ltr"></body>"
+Pass Document.parseHTML testcase 5, "<html><body><body class="body-cls" data-foo="bar"></body>"
+Pass Document.parseHTMLUnsafe testcase 0, "<body><body data-bad="strip-me" data-good="keep-me"></body>"
+Pass Document.parseHTMLUnsafe testcase 1, "<html data-bad-html="1" data-good-html="2"><body data-bad-body="3" data-good-body="4"></body>"
+Pass Document.parseHTMLUnsafe testcase 2, "<html><body><html data-dup-bad-html="1" data-dup-good-html="2"><body data-dup-bad-body="3" data-dup-good-body="4"></body>"
+Pass Document.parseHTMLUnsafe testcase 3, "<html title="html-title"><body title="body-title"><div title="div-title"></div></body>"
+Pass Fragment setHTML testcase 0, "<body id="test-body" onclick="alert(1)" class="safe-body"></body>"
+Pass Fragment setHTML testcase 1, "<body id="first" class="first"><body id="second" dir="rtl" onclick="alert(1)"></body>"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-get.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-get.txt
index bc80fc30214..e2983025d8b 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-get.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-get.txt
@@ -2,13 +2,13 @@ Harness status: OK
Found 9 tests
-9 Fail
-Fail Sorting of attributes
-Fail Sorting of removeAttributes
-Fail Sorting of elements
-Fail Sorting of removeElements
-Fail Sorting of replaceWithChildrenElements
-Fail Sorting of element's attributes
-Fail Sorting of element's removeAttributes
-Fail Sorting of processingInstructions
-Fail Sorting of removeProcessingInstructions
\ No newline at end of file
+9 Pass
+Pass Sorting of attributes
+Pass Sorting of removeAttributes
+Pass Sorting of elements
+Pass Sorting of removeElements
+Pass Sorting of replaceWithChildrenElements
+Pass Sorting of element's attributes
+Pass Sorting of element's removeAttributes
+Pass Sorting of processingInstructions
+Pass Sorting of removeProcessingInstructions
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-adoption-agency.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-adoption-agency.txt
index 11332c61830..85ed28f4404 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-adoption-agency.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-adoption-agency.txt
@@ -1,6 +1,60 @@
Harness status: OK
-Found 1 tests
+Found 55 tests
-1 Fail
-Fail Sanitizer Adoption Agency Algorithm testcases
\ No newline at end of file
+55 Pass
+Pass Sanitizer Adoption Agency Algorithm testcases
+Pass Testcase #0, "<b><i onclick="alert(1)"><div></b>x", config: "undefined".
+Pass Testcase #1, "<b><div>Text</b></div>", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #2, "<b><i><div>Text</b></div>", config: "{ "replaceWithChildrenElements": ["i"] }".
+Pass Testcase #3, "<b><div>Text</b>", config: "{ "removeElements": ["div"] }".
+Pass Testcase #4, "<b><div><b>x", config: "{ "removeElements": ["div"] }".
+Pass Testcase #5, "<b>1<p>foo</b>bar", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #6, "<b><div>Text</b>", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #7, "<a href="https://wpt.live/1"><div><a href="https://wpt.live/2">Click</a></div></a>", config: "{ "removeElements": ["div"] }".
+Pass Testcase #8, "<b><i><p>foo</b>bar</i>", config: "{ "removeElements": ["p"] }".
+Pass Testcase #9, "<b><i><p>foo</b>bar</i>", config: "{ "removeElements": ["i"] }".
+Pass Testcase #10, "<b><i><div>Text</b></i>", config: "{ "removeElements": ["div"], "replaceWithChildrenElements": ["i"] }".
+Pass Testcase #11, "<b><i onclick="alert(1)"><u onclick="alert(2)"><div></b>x", config: "undefined".
+Pass Testcase #12, "<b><em><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #13, "<b><em><s><div>Text</b>after</div>more", config: "{ "replaceWithChildrenElements": ["div", "s"] }".
+Pass Testcase #14, "<b><em><u><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #15, "<b><u><em><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["div", "em"] }".
+Pass Testcase #16, "<b><em><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["div"], "removeElements": ["em"] }".
+Pass Testcase #17, "<b><em><div><p>Text</b>after", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #18, "<b><div><section>Text</b>after", config: "{ "replaceWithChildrenElements": ["div", "section"] }".
+Pass Testcase #19, "<b><div><span>Text</b>after", config: "{ "replaceWithChildrenElements": ["span"] }".
+Pass Testcase #20, "<b><em><div>Text</b>after</div>more", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #21, "<b><div><div><div><div><div><div><div><div><section>Text</b>after", config: "{ "replaceWithChildrenElements": ["section"] }".
+Pass Testcase #22, "<b><div><div><div><div><div><div><div><div><section>Text</b>after", config: "{ "replaceWithChildrenElements": ["section", "b"] }".
+Pass Testcase #23, "<b><div><div><div><div><div><div><div><div><section><span>Text</b>after", config: "{ "replaceWithChildrenElements": ["section", "span"] }".
+Pass Testcase #24, "<b><div><div><div><div><div><div><div><div><section><i><span>Text</b>after", config: "{ "replaceWithChildrenElements": ["section", "span"] }".
+Pass Testcase #25, "<table><b><div>x</b>y", config: "undefined".
+Pass Testcase #26, "<table><b><div>x</b>y", config: "{ "removeElements": ["table"] }".
+Pass Testcase #27, "<table><b><div>x</b>y", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #28, "<table><tbody><b><div>x</b>y", config: "{ "replaceWithChildrenElements": ["tbody"] }".
+Pass Testcase #29, "<table><b><div>x</b>y", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #30, "<b><div>Text</b>after", config: "{ "removeElements": ["b"] }".
+Pass Testcase #31, "<p><b>x</p>y", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #32, "<p><b>x</p>y", config: "{ "removeElements": ["b"] }".
+Pass Testcase #33, "<p><i onclick="1">x</p>y", config: "undefined".
+Pass Testcase #34, "<p><b a="1"><b a="2"><b a="3"><b a="4"></p>x", config: "{ "removeAttributes": ["a"] }".
+Pass Testcase #35, "<b><i><u><p>foo</b>bar", config: "{ "removeElements": ["i"] }".
+Pass Testcase #36, "<b><div><p>Text</b>after", config: "{ "removeElements": ["p"] }".
+Pass Testcase #37, "<b><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["b", "div"] }".
+Pass Testcase #38, "<a href="1">x<div>y<a href="2">z", config: "{ "replaceWithChildrenElements": ["a"] }".
+Pass Testcase #39, "<a href="1">x<div>y<a href="2">z", config: "{ "removeElements": ["a"] }".
+Pass Testcase #40, "<b><span><div>x</b>y", config: "{ "removeElements": ["span"] }".
+Pass Testcase #41, "<b><div><table></b>x", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #42, "<b><i><div>Text</b>after", config: "{ "removeElements": ["div"] }".
+Pass Testcase #43, "<b><i><div>Text</b>after", config: "{ "replaceWithChildrenElements": ["i", "div"] }".
+Pass Testcase #44, "<div><b><p>x</b>y", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #45, "<div><b><p>x</b>y", config: "{ "removeElements": ["div"] }".
+Pass Testcase #46, "<b><u><em><div>Text</b>after</div>more", config: "{ "replaceWithChildrenElements": ["div", "em"] }".
+Pass Testcase #47, "<b><u><em><div>Text</b>after</div>more", config: "{ "replaceWithChildrenElements": ["div", "em"], "removeElements": ["u"] }".
+Pass Testcase #48, "<table><b><div>x</b><input type="hidden">", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #49, "<article><b><i><section><div><div><div><div><div><div><div><div>x</b>y</article>z", config: "undefined".
+Pass Testcase #50, "<article><b><i><section><div><div><div><div><div><div><div><div>x</b>y</article>z", config: "{ "replaceWithChildrenElements": ["section"] }".
+Pass Testcase #51, "<b><div><div><div><div><div><div><div><div>x</b>y", config: "undefined".
+Pass Testcase #52, "<b><div><div><div><div><div><div><div><div>x</b>y", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #53, "<b><u>1<p>foo</b><i>bar</i>baz", config: "{ "replaceWithChildrenElements": ["u"] }".
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-noahs-ark.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-noahs-ark.txt
index 14d09bba1f2..cae865d4a10 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-noahs-ark.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-in-noahs-ark.txt
@@ -2,26 +2,26 @@ Harness status: OK
Found 22 tests
-22 Fail
-Fail Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
-Fail Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
-Fail Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
-Fail Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
-Fail Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
-Fail Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
-Fail Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
-Fail Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
-Fail Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
-Fail Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
-Fail Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
-Fail Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
-Fail Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
-Fail Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
-Fail Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
-Fail Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with setHTML()
-Fail Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with setHTMLUnsafe()
-Fail Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with Document.parseHTML()
-Fail Testcase #6, "<p><b onclick=1>1<b onclick=2>2<b onclick=3>3<b onclick=4>4</p>x", config: "undefined", with setHTML()
-Fail Testcase #6, "<p><b onclick=1>1<b onclick=2>2<b onclick=3>3<b onclick=4>4</p>x", config: "undefined", with Document.parseHTML()
-Fail Testcase #7, "<p><b onclick=1>1<b onclick=1>2<b onclick=1>3<b onclick=1>4</p>x", config: "undefined", with setHTML()
-Fail Testcase #7, "<p><b onclick=1>1<b onclick=1>2<b onclick=1>3<b onclick=1>4</p>x", config: "undefined", with Document.parseHTML()
\ No newline at end of file
+22 Pass
+Pass Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
+Pass Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
+Pass Testcase #0, "<p><b title=1>1<b title=2>2<b title=3>3<b title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
+Pass Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
+Pass Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
+Pass Testcase #1, "<p><b title=1>1<b title=1>2<b title=1>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
+Pass Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
+Pass Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
+Pass Testcase #2, "<p><b>1<b>2<b>3<b title=1>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
+Pass Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
+Pass Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
+Pass Testcase #3, "<p><b title=1>1<b>2<b>3<b>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
+Pass Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTML()
+Pass Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with setHTMLUnsafe()
+Pass Testcase #4, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "removeAttributes": ["title"] }", with Document.parseHTML()
+Pass Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with setHTML()
+Pass Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with setHTMLUnsafe()
+Pass Testcase #5, "<p><b class=c title=1>1<b class=c title=2>2<b class=c title=3>3<b class=c title=4>4</p>x", config: "{ "attributes": ["class"] }", with Document.parseHTML()
+Pass Testcase #6, "<p><b onclick=1>1<b onclick=2>2<b onclick=3>3<b onclick=4>4</p>x", config: "undefined", with setHTML()
+Pass Testcase #6, "<p><b onclick=1>1<b onclick=2>2<b onclick=3>3<b onclick=4>4</p>x", config: "undefined", with Document.parseHTML()
+Pass Testcase #7, "<p><b onclick=1>1<b onclick=1>2<b onclick=1>3<b onclick=1>4</p>x", config: "undefined", with setHTML()
+Pass Testcase #7, "<p><b onclick=1>1<b onclick=1>2<b onclick=1>3<b onclick=1>4</p>x", config: "undefined", with Document.parseHTML()
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-inert-document.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-inert-document.txt
new file mode 100644
index 00000000000..45f35f2fb25
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-inert-document.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 4 tests
+
+2 Pass
+2 Fail
+Pass Test whether setHTML executes the fail handler.
+Pass Test whether setHTMLUnsafe executes the fail handler.
+Fail Test whether setHTML loads the image.
+Fail Test whether setHTMLUnsafe loads the image.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-javascript-url.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-javascript-url.txt
index 6055c864758..c9e17a83c52 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-javascript-url.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-javascript-url.txt
@@ -1,3 +1,1339 @@
-Harness status: Error
+Harness status: OK
-Found 0 tests
+Found 1334 tests
+
+1334 Pass
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/0, "<a href="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/1, "<area href="javascript:alert(1)"></area>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/2, "<button formaction="javascript:alert(1)"></button>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/3, "<form action="javascript:alert(1)"></form>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/4, "<input formaction="javascript:alert(1)"></input>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/5, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-navigating-url-attributes-list/6, "<svg><a xlink:href="javascript:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: {} } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/0, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: {} } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/1, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: {} } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/2, "<math><mtext href="javascript:alert(1)">Test</mtext></math>"
+Pass setHTML { sanitizer: {} } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml/3, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/0, "<svg><animate attributeName="href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/1, "<svg><animate attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/2, "<svg><animateMotion attributeName="href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/3, "<svg><animateMotion attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/4, "<svg><animateTransform attributeName="href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/5, "<svg><animateTransform attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/6, "<svg><set attributeName="href"></svg>"
+Pass setHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: {} } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase built-in-animating-url-attributes-list/7, "<svg><set attributeName="xlink:href"></svg>"
+Pass setHTML { sanitizer: {} } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/0, "<a nothref="javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTML { sanitizer: {} } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/1, "<svg><a xlink:href="data:text/html,foobar"></a></svg>"
+Pass setHTML { sanitizer: {} } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTML { sanitizer: {} } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase allowed/2, "<svg><set attributeName=" href "></svg>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/0, "<a href="JaVaScRiPt:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/1, "<a href=" javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/2, "<a href="&#10;javascript:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/3, "<a href="java&#9;script:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/4, "<a href="java&#10;script:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/5, "<a href="java&#13;script:alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/6, "<a href="javascript&#58;alert(1)"></a>"
+Pass setHTML { sanitizer: {} } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: {} } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase url-normalization/7, "<svg><a xlink:href="java&#9;script:alert(1)"></a></svg>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/0, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/1, "<math><a xlink:href="javascript:alert(1)"></a></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/2, "<math><annotation href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/3, "<math><annotation xlink:href="javascript:alert(1)"></annotation></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/4, "<math><annotation-xml href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/5, "<math><annotation-xml xlink:href="javascript:alert(1)"></annotation-xml></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/6, "<math><maction href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/7, "<math><maction xlink:href="javascript:alert(1)"></maction></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/8, "<math><menclose href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/9, "<math><menclose xlink:href="javascript:alert(1)"></menclose></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/10, "<math><merror href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/11, "<math><merror xlink:href="javascript:alert(1)"></merror></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/12, "<math><mfrac href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/13, "<math><mfrac xlink:href="javascript:alert(1)"></mfrac></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/14, "<math><mi href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/15, "<math><mi xlink:href="javascript:alert(1)"></mi></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/16, "<math><mmultiscripts href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/17, "<math><mmultiscripts xlink:href="javascript:alert(1)"></mmultiscripts></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/18, "<math><mn href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/19, "<math><mn xlink:href="javascript:alert(1)"></mn></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/20, "<math><mo href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/21, "<math><mo xlink:href="javascript:alert(1)"></mo></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/22, "<math><mover href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/23, "<math><mover xlink:href="javascript:alert(1)"></mover></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/24, "<math><mpadded href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/25, "<math><mpadded xlink:href="javascript:alert(1)"></mpadded></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/26, "<math><mphantom href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/27, "<math><mphantom xlink:href="javascript:alert(1)"></mphantom></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/28, "<math><mprescripts href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/29, "<math><mprescripts xlink:href="javascript:alert(1)"></mprescripts></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/30, "<math><mroot href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/31, "<math><mroot xlink:href="javascript:alert(1)"></mroot></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/32, "<math><mrow href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/33, "<math><mrow xlink:href="javascript:alert(1)"></mrow></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/34, "<math><ms href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/35, "<math><ms xlink:href="javascript:alert(1)"></ms></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/36, "<math><mspace href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/37, "<math><mspace xlink:href="javascript:alert(1)"></mspace></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/38, "<math><msqrt href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/39, "<math><msqrt xlink:href="javascript:alert(1)"></msqrt></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/40, "<math><mstyle href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/41, "<math><mstyle xlink:href="javascript:alert(1)"></mstyle></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/42, "<math><msub href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/43, "<math><msub xlink:href="javascript:alert(1)"></msub></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/44, "<math><msubsup href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/45, "<math><msubsup xlink:href="javascript:alert(1)"></msubsup></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/46, "<math><msup href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/47, "<math><msup xlink:href="javascript:alert(1)"></msup></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/48, "<math><mtable href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/49, "<math><mtable xlink:href="javascript:alert(1)"></mtable></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/50, "<math><mtd href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/51, "<math><mtd xlink:href="javascript:alert(1)"></mtd></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/52, "<math><mtext href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/53, "<math><mtext xlink:href="javascript:alert(1)"></mtext></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/54, "<math><mtr href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/55, "<math><mtr xlink:href="javascript:alert(1)"></mtr></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/56, "<math><munder href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/57, "<math><munder xlink:href="javascript:alert(1)"></munder></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/58, "<math><munderover href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/59, "<math><munderover xlink:href="javascript:alert(1)"></munderover></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/60, "<math><none href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/61, "<math><none xlink:href="javascript:alert(1)"></none></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/62, "<math><semantics href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: {} } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: {} } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: { javascriptURLs: true } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTML { sanitizer: new Sanitizer({ javascriptURLs: true }) } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: { javascriptURLs: false } } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({ javascriptURLs: false }) } testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer({}) } after removeUnsafe() testcase mathml-all-elements/63, "<math><semantics xlink:href="javascript:alert(1)"></semantics></math>"
+Pass setHTMLUnsafe { sanitizer: "default" } default configuration, "<a href="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: "default" } default configuration, "<a href="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<a href="javascript:alert(1)"></a>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<a href="javascript:alert(1)"></a>"
+Pass setJavascriptURLs(true) on the default configuration, "<a href="javascript:alert(1)"></a>"
+Pass setHTMLUnsafe { sanitizer: "default" } default configuration, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: "default" } default configuration, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setJavascriptURLs(true) on the default configuration, "<svg><a href="javascript:alert(1)"></a></svg>"
+Pass setHTMLUnsafe { sanitizer: "default" } default configuration, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: "default" } default configuration, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<math><a href="javascript:alert(1)"></a></math>"
+Pass parseHTMLUnsafe { sanitizer: new Sanitizer() } default configuration, "<math><a href="javascript:alert(1)"></a></math>"
+Pass setJavascriptURLs(true) on the default configuration, "<math><a href="javascript:alert(1)"></a></math>"
+Pass javascript: URLs preserved in unsafe methods when javascriptURLs is true
+Pass sanitizer.setJavascriptURLs() controls URL preservation in setHTMLUnsafe
+Pass Template and ShadowRoot handling with javascriptURLs
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-modifiers.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-modifiers.txt
index 2e21f6d2233..273a6ccf386 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-modifiers.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-modifiers.txt
@@ -2,26 +2,26 @@ Harness status: OK
Found 22 tests
-22 Fail
-Fail sanitizer.allowAttribute() with global attributes
-Fail sanitizer.allowAttribute() with global removeAttributes
-Fail sanitizer.allowAttribute() with global attributes and elements
-Fail sanitizer.allowAttribute() with global removeAttributes and element's attributes
-Fail sanitizer.allowAttribute() with global removeAttributes and element's removeAttributes
-Fail sanitizer.removeAttribute() with global attributes
-Fail sanitizer.removeAttribute() with global removeAttributes
-Fail sanitizer.removeAttribute() with global attributes and elements
-Fail sanitizer.removeAttribute() with global removeAttributes and element's attributes
-Fail sanitizer.removeAttribute() with global removeAttributes and element's removeAttributes
-Fail sanitizer.removeElement() with global elements
-Fail sanitizer.removeElement() with global removeElements
-Fail sanitizer.replaceElementWithChildren() with global elements
-Fail sanitizer.replaceElementWithChildren() with global removeElements
-Fail sanitizer.allowElement() with global elements
-Fail sanitizer.allowElement() with global removeElements
-Fail sanitizer.allowElement() with global elements and attributes
-Fail sanitizer.allowElement() with global elements and removeAttributes
-Fail sanitizer.replaceElementWithChildren() does not allow non-replaceable elements.
-Fail sanitizer.setJavascriptURLs()
-Fail sanitizer.setComments()
-Fail sanitizer.setDataAttributes()
\ No newline at end of file
+22 Pass
+Pass sanitizer.allowAttribute() with global attributes
+Pass sanitizer.allowAttribute() with global removeAttributes
+Pass sanitizer.allowAttribute() with global attributes and elements
+Pass sanitizer.allowAttribute() with global removeAttributes and element's attributes
+Pass sanitizer.allowAttribute() with global removeAttributes and element's removeAttributes
+Pass sanitizer.removeAttribute() with global attributes
+Pass sanitizer.removeAttribute() with global removeAttributes
+Pass sanitizer.removeAttribute() with global attributes and elements
+Pass sanitizer.removeAttribute() with global removeAttributes and element's attributes
+Pass sanitizer.removeAttribute() with global removeAttributes and element's removeAttributes
+Pass sanitizer.removeElement() with global elements
+Pass sanitizer.removeElement() with global removeElements
+Pass sanitizer.replaceElementWithChildren() with global elements
+Pass sanitizer.replaceElementWithChildren() with global removeElements
+Pass sanitizer.allowElement() with global elements
+Pass sanitizer.allowElement() with global removeElements
+Pass sanitizer.allowElement() with global elements and attributes
+Pass sanitizer.allowElement() with global elements and removeAttributes
+Pass sanitizer.replaceElementWithChildren() does not allow non-replaceable elements.
+Pass sanitizer.setJavascriptURLs()
+Pass sanitizer.setComments()
+Pass sanitizer.setDataAttributes()
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-parseHTML.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-parseHTML.txt
index f50c0ec5f36..30d3d7baa14 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-parseHTML.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-parseHTML.txt
@@ -2,56 +2,56 @@ Harness status: OK
Found 49 tests
-14 Pass
-35 Fail
-Fail parseHTML testcase 0, "text"
-Fail parseHTML testcase 1, "<div>text"
-Fail parseHTML testcase 2, "<div>text"
-Fail parseHTML testcase 3, "<div>text"
+48 Pass
+1 Fail
+Pass parseHTML testcase 0, "text"
+Pass parseHTML testcase 1, "<div>text"
+Pass parseHTML testcase 2, "<div>text"
+Pass parseHTML testcase 3, "<div>text"
Pass parseHTML testcase 4, "<html onload="3 + 3"><div>a"
-Fail parseHTML testcase 5, "<body><body onload="alert(1)">Hello"
-Fail parseHTML testcase 6, "<!-- a --><html><body>x<!-- b --></body></html><!-- c -->"
-Fail parseHTML testcase 7, "<?a b?><html><body>x<?c d?></body></html><?e f?>"
-Fail parseHTML testcase 8, "x<p>y"
-Fail parseHTML testcase 9, "<noscript><p>x</noscript>y"
-Fail parseHTML testcase 10, "<noscript><p>x</noscript>y"
-Fail parseHTML testcase 11, "<script>hello"
-Fail parseHTML testcase 12, "<html onload="2+2"><body onload="3+3"><div>hello"
-Fail parseHTML testcase 13, "<div data-xyz="1" id="2" title="3">"
-Fail parseHTML testcase 14, "<div>a<!-- xx -->b"
+Pass parseHTML testcase 5, "<body><body onload="alert(1)">Hello"
+Pass parseHTML testcase 6, "<!-- a --><html><body>x<!-- b --></body></html><!-- c -->"
+Pass parseHTML testcase 7, "<?a b?><html><body>x<?c d?></body></html><?e f?>"
+Pass parseHTML testcase 8, "x<p>y"
+Pass parseHTML testcase 9, "<noscript><p>x</noscript>y"
+Pass parseHTML testcase 10, "<noscript><p>x</noscript>y"
+Pass parseHTML testcase 11, "<script>hello"
+Pass parseHTML testcase 12, "<html onload="2+2"><body onload="3+3"><div>hello"
+Pass parseHTML testcase 13, "<div data-xyz="1" id="2" title="3">"
+Pass parseHTML testcase 14, "<div>a<!-- xx -->b"
Pass parseHTML testcase 15, "<html onload="2 + 2"><div>a"
-Fail parseHTML testcase 16, "<br id="document">"
-Fail parseHTML testcase 17, "<br id="document">"
-Fail parseHTML testcase 18, "<p onclick="alert(document.cookie)">Click handler!</p>"
-Fail parseHTML testcase 19, "<p onclick="alert(document.cookie)">Click handler!</p>"
-Fail parseHTML testcase 20, "<noscript><p>x</noscript>y"
+Pass parseHTML testcase 16, "<br id="document">"
+Pass parseHTML testcase 17, "<br id="document">"
+Pass parseHTML testcase 18, "<p onclick="alert(document.cookie)">Click handler!</p>"
+Pass parseHTML testcase 19, "<p onclick="alert(document.cookie)">Click handler!</p>"
+Pass parseHTML testcase 20, "<noscript><p>x</noscript>y"
Pass parseHTMLUnsafe testcase 0, "text"
-Fail parseHTMLUnsafe testcase 1, "<div>text"
-Fail parseHTMLUnsafe testcase 2, "<div>text"
-Fail parseHTMLUnsafe testcase 3, "<div>text"
-Fail parseHTMLUnsafe testcase 4, "<html onload="3 + 3"><div>a"
-Fail parseHTMLUnsafe testcase 5, "<body><body onload="alert(1)">Hello"
-Fail parseHTMLUnsafe testcase 6, "<!-- a --><html><body>x<!-- b --></body></html><!-- c -->"
+Pass parseHTMLUnsafe testcase 1, "<div>text"
+Pass parseHTMLUnsafe testcase 2, "<div>text"
+Pass parseHTMLUnsafe testcase 3, "<div>text"
+Pass parseHTMLUnsafe testcase 4, "<html onload="3 + 3"><div>a"
+Pass parseHTMLUnsafe testcase 5, "<body><body onload="alert(1)">Hello"
+Pass parseHTMLUnsafe testcase 6, "<!-- a --><html><body>x<!-- b --></body></html><!-- c -->"
Fail parseHTMLUnsafe testcase 7, "<?a b?><html><body>x<?c d?></body></html><?e f?>"
-Fail parseHTMLUnsafe testcase 8, "x<p>y"
+Pass parseHTMLUnsafe testcase 8, "x<p>y"
Pass parseHTMLUnsafe testcase 9, "<noscript><p>x</noscript>y"
Pass parseHTMLUnsafe testcase 10, "<noscript><p>x</noscript>y"
Pass parseHTMLUnsafe testcase 11, "<script>hello"
Pass parseHTMLUnsafe testcase 12, "<html onload="2+2"><body onload="3+3"><div>hello"
-Fail parseHTMLUnsafe testcase 13, "<div data-xyz="1" id="2" title="3">"
+Pass parseHTMLUnsafe testcase 13, "<div data-xyz="1" id="2" title="3">"
Pass parseHTMLUnsafe testcase 14, "<div>a<!-- xx -->b"
-Fail parseHTMLUnsafe testcase 15, "<html onload="2 + 2"><div>a"
+Pass parseHTMLUnsafe testcase 15, "<html onload="2 + 2"><div>a"
Pass parseHTMLUnsafe testcase 16, "<div>a<!-- xx -->b"
Pass parseHTMLUnsafe testcase 17, "<!-- 1 --><html><body>x<!-- 2 --></body></html><!-- 3 -->"
-Fail parseHTMLUnsafe testcase 18, "a<template>x</template>b"
+Pass parseHTMLUnsafe testcase 18, "a<template>x</template>b"
Pass parseHTMLUnsafe testcase 19, "<noscript><p>x</noscript>y"
-Fail parseHTMLUnsafe testcase 20, "<head><meta></head><body>x"
-Fail parseHTMLUnsafe testcase 21, "<head></head><body>x<p>y"
-Fail parseHTMLUnsafe testcase 22, "<head></head><meta><body>x"
-Fail parseHTMLUnsafe testcase 23, "<div></div><frameset>"
+Pass parseHTMLUnsafe testcase 20, "<head><meta></head><body>x"
+Pass parseHTMLUnsafe testcase 21, "<head></head><body>x<p>y"
+Pass parseHTMLUnsafe testcase 22, "<head></head><meta><body>x"
+Pass parseHTMLUnsafe testcase 23, "<div></div><frameset>"
Pass parseHTMLUnsafe testcase 24, "<div></div><frameset>"
Pass parseHTMLUnsafe() without options keeps comments
Pass parseHTMLUnsafe full document testcase 0, "<!DOCTYPE html>
text"
-Fail parseHTML full document testcase 0, "<!DOCTYPE html>
+Pass parseHTML full document testcase 0, "<!DOCTYPE html>
text"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-processing-instructions.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-processing-instructions.txt
index 7a28331fdee..8d140d0f91c 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-processing-instructions.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-processing-instructions.txt
@@ -2,7 +2,8 @@ Harness status: OK
Found 63 tests
-63 Fail
+12 Pass
+51 Fail
Fail setHTMLUnsafe testcase agnostic/0, "<?target data?>"
Fail ShadowRoot.setHTMLUnsafe testcase agnostic/0, "<?target data?>"
Fail setHTML testcase agnostic/0, "<?target data?>"
@@ -17,15 +18,15 @@ Fail parseHTML testcase agnostic/1, "<?target data?>"
Fail parseHTMLUnsafe testcase agnostic/1, "<?target data?>"
Fail setHTMLUnsafe testcase agnostic/2, "<?Target data?>"
Fail ShadowRoot.setHTMLUnsafe testcase agnostic/2, "<?Target data?>"
-Fail setHTML testcase agnostic/2, "<?Target data?>"
-Fail ShadowRoot.setHTML testcase agnostic/2, "<?Target data?>"
-Fail parseHTML testcase agnostic/2, "<?Target data?>"
+Pass setHTML testcase agnostic/2, "<?Target data?>"
+Pass ShadowRoot.setHTML testcase agnostic/2, "<?Target data?>"
+Pass parseHTML testcase agnostic/2, "<?Target data?>"
Fail parseHTMLUnsafe testcase agnostic/2, "<?Target data?>"
Fail setHTMLUnsafe testcase agnostic/3, "<?target data?>"
Fail ShadowRoot.setHTMLUnsafe testcase agnostic/3, "<?target data?>"
-Fail setHTML testcase agnostic/3, "<?target data?>"
-Fail ShadowRoot.setHTML testcase agnostic/3, "<?target data?>"
-Fail parseHTML testcase agnostic/3, "<?target data?>"
+Pass setHTML testcase agnostic/3, "<?target data?>"
+Pass ShadowRoot.setHTML testcase agnostic/3, "<?target data?>"
+Pass parseHTML testcase agnostic/3, "<?target data?>"
Fail parseHTMLUnsafe testcase agnostic/3, "<?target data?>"
Fail setHTMLUnsafe testcase agnostic/4, "<?target-1 data?><?target-2 data?>"
Fail ShadowRoot.setHTMLUnsafe testcase agnostic/4, "<?target-1 data?><?target-2 data?>"
@@ -47,9 +48,9 @@ Fail parseHTML testcase agnostic/6, "<div><?target data?></div>"
Fail parseHTMLUnsafe testcase agnostic/6, "<div><?target data?></div>"
Fail setHTMLUnsafe testcase agnostic/7, "<div><?unlisted-target data?></div>"
Fail ShadowRoot.setHTMLUnsafe testcase agnostic/7, "<div><?unlisted-target data?></div>"
-Fail setHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
-Fail ShadowRoot.setHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
-Fail parseHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
+Pass setHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
+Pass ShadowRoot.setHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
+Pass parseHTML testcase agnostic/7, "<div><?unlisted-target data?></div>"
Fail parseHTMLUnsafe testcase agnostic/7, "<div><?unlisted-target data?></div>"
Fail setHTMLUnsafe testcase unsafe-only/0, "<?target data?>"
Fail ShadowRoot.setHTMLUnsafe testcase unsafe-only/0, "<?target data?>"
@@ -63,6 +64,6 @@ Fail parseHTMLUnsafe testcase unsafe-only/2, "<div><?target data?></div>"
Fail setHTMLUnsafe testcase unsafe-only/3, "<div><?target data?></div>"
Fail ShadowRoot.setHTMLUnsafe testcase unsafe-only/3, "<div><?target data?></div>"
Fail parseHTMLUnsafe testcase unsafe-only/3, "<div><?target data?></div>"
-Fail setHTML testcase safe-only/0, "<div><?target data?></div>"
-Fail ShadowRoot.setHTML testcase safe-only/0, "<div><?target data?></div>"
-Fail parseHTML testcase safe-only/0, "<div><?target data?></div>"
\ No newline at end of file
+Pass setHTML testcase safe-only/0, "<div><?target data?></div>"
+Pass ShadowRoot.setHTML testcase safe-only/0, "<div><?target data?></div>"
+Pass parseHTML testcase safe-only/0, "<div><?target data?></div>"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-removeUnsafe.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-removeUnsafe.txt
index c9715f29c8b..89af3191c06 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-removeUnsafe.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-removeUnsafe.txt
@@ -2,12 +2,12 @@ Harness status: OK
Found 8 tests
-8 Fail
-Fail removeUnsafe removes the right elements and attributes
-Fail removeUnsafe with default config
-Fail removeUnsafe sets javascriptURLs to false
-Fail Baseline remove list is namespace specific #0: {"name":"script","namespace":"http://www.w3.org/1999/xhtml"}
-Fail Baseline remove list is namespace specific #1: {"name":"script","namespace":"http://www.w3.org/2000/svg"}
-Fail Baseline remove list is namespace specific #2: {"name":"use","namespace":"http://www.w3.org/2000/svg"}
-Fail Baseline remove list is namespace specific #3: {"name":"use","namespace":"http://www.w3.org/1999/xhtml"}
-Fail Baseline remove list is namespace specific #4: {"name":"script","namespace":"http://www.w3.org/1998/Math/MathML"}
\ No newline at end of file
+8 Pass
+Pass removeUnsafe removes the right elements and attributes
+Pass removeUnsafe with default config
+Pass removeUnsafe sets javascriptURLs to false
+Pass Baseline remove list is namespace specific #0: {"name":"script","namespace":"http://www.w3.org/1999/xhtml"}
+Pass Baseline remove list is namespace specific #1: {"name":"script","namespace":"http://www.w3.org/2000/svg"}
+Pass Baseline remove list is namespace specific #2: {"name":"use","namespace":"http://www.w3.org/2000/svg"}
+Pass Baseline remove list is namespace specific #3: {"name":"use","namespace":"http://www.w3.org/1999/xhtml"}
+Pass Baseline remove list is namespace specific #4: {"name":"script","namespace":"http://www.w3.org/1998/Math/MathML"}
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-script-tokenizer.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-script-tokenizer.txt
index 3fec0aca53c..0b67822911e 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-script-tokenizer.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sanitizer-script-tokenizer.txt
@@ -1,6 +1,15 @@
Harness status: OK
-Found 1 tests
+Found 10 tests
-1 Fail
-Fail Sanitizer script and raw text tokenizer testcases from sub.dat
\ No newline at end of file
+10 Pass
+Pass Sanitizer script and raw text tokenizer testcases from sub.dat
+Pass Testcase #0 [setHTML], "<script><img src=x onerror='window.scriptRan=true;'><div>content</div></script>", config: "{}"
+Pass Testcase #1 [setHTML], "<script><img src=x onerror='window.scriptRan=true;'><div>content</div></script>", config: "{ "removeElements": ["script"] }"
+Pass Testcase #2 [setHTMLUnsafe], "<script><b>bold text</b><img src=x></script>", config: "{ "replaceWithChildrenElements": ["script"] }"
+Pass Testcase #3 [setHTMLUnsafe], "<style><img src=x><div>test</div></style>", config: "{ "replaceWithChildrenElements": ["style"] }"
+Pass Testcase #4 [setHTMLUnsafe], "<textarea><img src=x><div>test</div></textarea>", config: "{ "replaceWithChildrenElements": ["textarea"] }"
+Pass Testcase #5 [setHTML], "<script><b>Hello</b></script>", config: "{ "replaceWithChildrenElements": ["script"] }"
+Pass Testcase #6 [setHTMLUnsafe], "<script><b>Hello</b></script>", config: "{ "removeElements": ["script"] }"
+Pass Testcase #7 [setHTMLUnsafe], "<p>before</p><script><b>bold text</b><img src=x></script><p>after</p>", config: "{ "replaceWithChildrenElements": ["script"] }"
+Pass Testcase #8 [setHTML], "<p>before</p><script><b>bold text</b><img src=x></script><p>after</p>", config: "{}"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-custom-element-reactions.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-custom-element-reactions.txt
index 4670436034e..2c1656fba98 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-custom-element-reactions.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-custom-element-reactions.txt
@@ -2,13 +2,12 @@ Harness status: OK
Found 8 tests
-4 Pass
-4 Fail
-Fail Element.setHTML with a sanitizer runs custom element reactions before returning
-Fail Element.setHTML with a sanitizer runs disconnectedCallback for the replaced children before returning
+8 Pass
+Pass Element.setHTML with a sanitizer runs custom element reactions before returning
+Pass Element.setHTML with a sanitizer runs disconnectedCallback for the replaced children before returning
Pass Element.setHTMLUnsafe with a sanitizer runs custom element reactions before returning
Pass Element.setHTMLUnsafe with a sanitizer runs disconnectedCallback for the replaced children before returning
-Fail ShadowRoot.setHTML with a sanitizer runs custom element reactions before returning
-Fail ShadowRoot.setHTML with a sanitizer runs disconnectedCallback for the replaced children before returning
+Pass ShadowRoot.setHTML with a sanitizer runs custom element reactions before returning
+Pass ShadowRoot.setHTML with a sanitizer runs disconnectedCallback for the replaced children before returning
Pass ShadowRoot.setHTMLUnsafe with a sanitizer runs custom element reactions before returning
Pass ShadowRoot.setHTMLUnsafe with a sanitizer runs disconnectedCallback for the replaced children before returning
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-form-owner.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-form-owner.txt
index 4bd978f15d6..91218a7e870 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-form-owner.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-form-owner.txt
@@ -2,9 +2,8 @@ Harness status: OK
Found 4 tests
-2 Pass
-2 Fail
+4 Pass
Pass Without a sanitizer, the input's form owner is the parsed form
-Fail With the form replaced with its children, the input has no form owner
+Pass With the form replaced with its children, the input has no form owner
Pass parseHTMLUnsafe(): without a sanitizer, the input's form owner is the parsed form
-Fail parseHTMLUnsafe(): with the form replaced with its children, the input has no form owner
\ No newline at end of file
+Pass parseHTMLUnsafe(): with the form replaced with its children, the input has no form owner
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-noscript.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-noscript.txt
index c7d8322193f..ed119779544 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-noscript.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-noscript.txt
@@ -2,11 +2,10 @@ Harness status: OK
Found 6 tests
-4 Pass
-2 Fail
+6 Pass
Pass setHTMLUnsafe() parses noscript as raw text (no options)
Pass setHTMLUnsafe() parses noscript as raw text (empty options)
Pass setHTMLUnsafe() parses noscript as raw text (sanitizer: undefined)
Pass setHTMLUnsafe() parses noscript as raw text (empty sanitizer config)
-Fail setHTML() parses noscript as raw text when noscript is allowed
-Fail setHTML() removes noscript with its raw text content by default
\ No newline at end of file
+Pass setHTML() parses noscript as raw text when noscript is allowed
+Pass setHTML() removes noscript with its raw text content by default
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-replace-with-children.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-replace-with-children.txt
index 37760fdc868..d6e85ac7df6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-replace-with-children.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-replace-with-children.txt
@@ -2,10 +2,10 @@ Harness status: OK
Found 6 tests
-6 Fail
-Fail setHTML: children of a replaced element get the target's node document
-Fail setHTML: a declarative shadow root inside a replaced element is not attached
-Fail setHTMLUnsafe: children of a replaced element get the target's node document
-Fail setHTMLUnsafe: a declarative shadow root inside a replaced element is not attached
-Fail setHTMLUnsafe: a custom element inside a replaced element is constructed and connected to the target
-Fail setHTMLUnsafe: a custom element inside a foster-parented replaced element is connected before the table
\ No newline at end of file
+6 Pass
+Pass setHTML: children of a replaced element get the target's node document
+Pass setHTML: a declarative shadow root inside a replaced element is not attached
+Pass setHTMLUnsafe: children of a replaced element get the target's node document
+Pass setHTMLUnsafe: a declarative shadow root inside a replaced element is not attached
+Pass setHTMLUnsafe: a custom element inside a replaced element is constructed and connected to the target
+Pass setHTMLUnsafe: a custom element inside a foster-parented replaced element is connected before the table
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-safety.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-safety.txt
index 23f79868c71..92a2d1fe507 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-safety.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-safety.txt
@@ -1,6 +1,38 @@
Harness status: OK
-Found 1 tests
+Found 33 tests
-1 Fail
-Fail wrapper
\ No newline at end of file
+33 Pass
+Pass wrapper
+Pass Testcase #0, setHTML("test").
+Pass Testcase #1, setHTML("<p>Hello</p>").
+Pass Testcase #2, setHTML("<div>Hello<script>World</script>xxx").
+Pass Testcase #3, setHTML("<div>Hello<script>World</script>xxx").
+Pass Testcase #4, setHTML("<svg>Hello<script>World</script>xxx").
+Pass Testcase #5, setHTML("<a href="https://wpt.live/" onclick="2+2" one="two">").
+Pass Testcase #6, setHTML("<a href="https://wpt.live/" onclick="2+2" one="two">").
+Pass Testcase #7, setHTML("<img src="https://wpt.live/test-image" onclick="2+2" one="two">").
+Pass Testcase #8, setHTML("<p data-x="1" data-y="2" data-z="3">").
+Pass Testcase #9, setHTML("<div><base href="https://example.org/"></base></div>").
+Pass Testcase #10, setHTML("<div><embed src="https://example.org/"></embed></div>").
+Pass Testcase #11, setHTML("<div><iframe src="https://example.org/"></iframe></div>").
+Pass Testcase #12, setHTML("<div><object data="https://example.org/"></object></div>").
+Pass Testcase #13, setHTML("<div><script src="https://example.org/"></script></div>").
+Pass Testcase #14, setHTML("<svg><script src="https://example.org/"></script></svg>").
+Pass Testcase #15, setHTML("<svg><use href="https://example.org/"></use></svg>").
+Pass Testcase #0, setHTMLUnsafe("test").
+Pass Testcase #1, setHTMLUnsafe("<p>Hello</p>").
+Pass Testcase #2, setHTMLUnsafe("<div>Hello<script>World</script>xxx").
+Pass Testcase #3, setHTMLUnsafe("<div>Hello<script>World</script>xxx").
+Pass Testcase #4, setHTMLUnsafe("<svg>Hello<script>World</script>xxx").
+Pass Testcase #5, setHTMLUnsafe("<a href="https://wpt.live/" onclick="2+2" one="two">").
+Pass Testcase #6, setHTMLUnsafe("<a href="https://wpt.live/" onclick="2+2" one="two">").
+Pass Testcase #7, setHTMLUnsafe("<img src="https://wpt.live/test-image" onclick="2+2" one="two">").
+Pass Testcase #8, setHTMLUnsafe("<p data-x="1" data-y="2" data-z="3">").
+Pass Testcase #9, setHTMLUnsafe("<div><base href="https://example.org/"></base></div>").
+Pass Testcase #10, setHTMLUnsafe("<div><embed src="https://example.org/"></embed></div>").
+Pass Testcase #11, setHTMLUnsafe("<div><iframe src="https://example.org/"></iframe></div>").
+Pass Testcase #12, setHTMLUnsafe("<div><object data="https://example.org/"></object></div>").
+Pass Testcase #13, setHTMLUnsafe("<div><script src="https://example.org/"></script></div>").
+Pass Testcase #14, setHTMLUnsafe("<svg><script src="https://example.org/"></script></svg>").
+Pass Testcase #15, setHTMLUnsafe("<svg><use href="https://example.org/"></use></svg>").
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-scoped-custom-element-registry.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-scoped-custom-element-registry.txt
index 4ab1f860257..4d129ca7f69 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-scoped-custom-element-registry.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-scoped-custom-element-registry.txt
@@ -2,14 +2,13 @@ Harness status: OK
Found 9 tests
-4 Pass
-5 Fail
-Fail setHTML uses the target's scoped custom element registry
-Fail setHTML with replaceWithChildrenElements preserves the scoped custom element registry for children
-Fail setHTML on a shadow root uses the shadow root's registry, not the host's
-Fail setHTML constructs nested custom elements with the scoped registry
+9 Pass
+Pass setHTML uses the target's scoped custom element registry
+Pass setHTML with replaceWithChildrenElements preserves the scoped custom element registry for children
+Pass setHTML on a shadow root uses the shadow root's registry, not the host's
+Pass setHTML constructs nested custom elements with the scoped registry
Pass setHTMLUnsafe uses the target's scoped custom element registry
Pass setHTMLUnsafe with a sanitizer uses the target's scoped custom element registry
-Fail setHTMLUnsafe with replaceWithChildrenElements preserves the scoped custom element registry for children
+Pass setHTMLUnsafe with replaceWithChildrenElements preserves the scoped custom element registry for children
Pass setHTMLUnsafe on a shadow root uses the shadow root's registry, not the host's
Pass setHTMLUnsafe constructs nested custom elements with the scoped registry
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-tree-construction.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-tree-construction.txt
index 9c79f0e5995..111c008b584 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-tree-construction.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-tree-construction.txt
@@ -1,11 +1,147 @@
Harness status: OK
-Found 6 tests
+Found 126 tests
-6 Fail
-Fail wrapper
-Fail Non-string input: empty object.
-Fail Non-string input: number.
-Fail Non-string input: octal number.
-Fail Non-string input: expression.
-Fail Non-string input: undefined.
\ No newline at end of file
+126 Pass
+Pass wrapper
+Pass Non-string input: empty object.
+Pass Non-string input: number.
+Pass Non-string input: octal number.
+Pass Non-string input: expression.
+Pass Non-string input: undefined.
+Pass Testcase #0, "test", config: "undefined".
+Pass Testcase #1, "<b>bla</b>", config: "undefined".
+Pass Testcase #2, "<a<embla", config: "undefined".
+Pass Testcase #3, "<html><head></head><body>test</body></html>", config: "undefined".
+Pass Testcase #4, "<div>test", config: "undefined".
+Pass Testcase #5, "<script>alert('i am a test')</script>", config: "undefined".
+Pass Testcase #6, "hello<script>alert('i am a test')</script>", config: "undefined".
+Pass Testcase #7, "<div><b>hello<script>alert('i am a test')</script>", config: "undefined".
+Pass Testcase #8, "<p onclick='a= 123'>Click.</p>", config: "undefined".
+Pass Testcase #9, "<plaintext><p>text</p>", config: "{}".
+Pass Testcase #10, "<xmp>TEXT</xmp>", config: "{}".
+Pass Testcase #11, "test", config: "{ "test": 123 }".
+Pass Testcase #12, "test", config: "{ "removeElements": [] }".
+Pass Testcase #13, "<div>test</div><p>bla", config: "{ "removeElements": ["div"] }".
+Pass Testcase #14, "<custom-element>test1</custom-element>bla", config: "undefined".
+Pass Testcase #15, "<custom-element>test3</custom-element>bla", config: "{ "elements": ["custom-element"] }".
+Pass Testcase #16, "<custom-element>test5</custom-element>bla", config: "{ "removeElements": ["custom-element"] }".
+Pass Testcase #17, "<script>alert('i am a test')</script>", config: "{ "removeElements": ["script"] }".
+Pass Testcase #18, "<div>balabala<i>test</i></div><test-element>t</test-element>", config: "{ "removeElements": ["test-element", "i"] }".
+Pass Testcase #19, "<div>balabala<i>i</i><p>t</p></div>", config: "{ "removeElements": ["dl", "p"] }".
+Pass Testcase #20, "<div>test<div>p</div>tt<p>div</p></div>", config: "{ "elements": ["p"], "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #21, "<div>test</div><p>bla", config: "{ "removeElements": ["div"], "elements": ["div"] }".
+Pass Testcase #22, "<p id='test'>Click.</p>", config: "{ "removeAttributes": [] }".
+Pass Testcase #23, "<p id='test'>Click.</p>", config: "{ "removeAttributes": ["id"] }".
+Pass Testcase #24, "<p id='test'>Click.</p>", config: "{ "elements": ["p"], "removeAttributes": ["id"] }".
+Pass Testcase #25, "<p id='p' data-attribute-with-dashes='123'>Click.</p><script>document.getElementById('p').dataset.attributeWithDashes=123;</script>", config: "{ "elements": ["p"], "removeAttributes": ["data-attribute-with-dashes"] }".
+Pass Testcase #26, "<p id='p' title='p'>P</p><div id='div' title='div'>DIV</div>", config: "{ "elements": [
+ { "name": "p", "attributes": ["title"] },
+ { "name": "div", "attributes": ["id"] }
+]}".
+Pass Testcase #27, "<p id='p' title='p'>P</p><div id='div' title='div'>DIV</div>", config: "{ "elements":
+ [
+ { "name": "p", "removeAttributes": ["title"] },
+ { "name": "div", "removeAttributes": ["id"] }
+ ]
+}".
+Pass Testcase #28, "<div id='div' title='div'>DIV</div>", config: "{ "elements": [{ "name": "div", "attributes": ["id"], "removeAttributes": ["id"] }]}".
+Pass Testcase #29, "<div id='div' title='div'>DIV</div>", config: "{ "elements": [{ "name": "div", "attributes": ["id", "title"] }],
+ "attributes": []}".
+Pass Testcase #30, "<div id='div' title='div'>DIV</div>", config: "{
+ "elements": [{ "name": "div", "attributes": [] }],
+ "removeAttributes": ["id", "title"]
+}".
+Pass Testcase #31, "<div id='div' title='div'>DIV</div>", config: "{
+ "elements": [{ "name": "div", "removeAttributes": ["id", "title"] }],
+ "attributes": ["id", "title"]
+}".
+Pass Testcase #32, "<p id='test' onclick='a= 123'>Click.</p>", config: "{ "attributes": ["id"] }".
+Pass Testcase #33, "<p style='color: black'>Click.</p>", config: "{ "removeAttributes": ["style"], "attributes": ["style"] }".
+Pass Testcase #34, "<template><script>test</script><div>hello</div></template>", config: "{ "elements": ["template", "div"] }".
+Pass Testcase #35, "<a href='javascript:evil.com'>Click.</a>", config: "undefined".
+Pass Testcase #36, "<a href=' javascript:evil.com'>Click.</a>", config: "undefined".
+Pass Testcase #37, "<a href='http:evil.com'>Click.</a>", config: "undefined".
+Pass Testcase #38, "<area href='javascript:evil.com'>", config: "{}".
+Pass Testcase #39, "<area href=' javascript:evil.com'>", config: "{}".
+Pass Testcase #40, "<area href='http:evil.com'>", config: "{}".
+Pass Testcase #41, "<form action='javascript:evil.com'>Click.</form>", config: "{}".
+Pass Testcase #42, "<form action=' javascript:evil.com'>Click.</form>", config: "{}".
+Pass Testcase #43, "<form action='http:evil.com'>Click.</form>", config: "{}".
+Pass Testcase #44, "<input formaction='javascript:evil.com'>", config: "{}".
+Pass Testcase #45, "<input formaction=' javascript:evil.com'>", config: "{}".
+Pass Testcase #46, "<input formaction='http:evil.com'>", config: "{}".
+Pass Testcase #47, "<button formaction='javascript:evil.com'>Click.</button>", config: "{}".
+Pass Testcase #48, "<button formaction=' javascript:evil.com'>Click.</button>", config: "{}".
+Pass Testcase #49, "<button formaction='http:evil.com'>Click.</button>", config: "{}".
+Pass Testcase #50, "<p>Some text</p></body><!-- 1 --></html><!-- 2 --><p>Some more text</p>", config: "undefined".
+Pass Testcase #51, "<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>", config: "undefined".
+Pass Testcase #52, "<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>", config: "{ "comments": true }".
+Pass Testcase #53, "<p>Some text</p><!-- 1 --><!-- 2 --><p>Some more text</p>", config: "{ "comments": false }".
+Pass Testcase #54, "<p>comment<!-- hello -->in<!-- </p> -->text</p>", config: "undefined".
+Pass Testcase #55, "<p>comment<!-- hello -->in<!-- </p> -->text</p>", config: "{ "comments": true }".
+Pass Testcase #56, "<p>comment<!-- hello -->in<!-- </p> -->text</p>", config: "{ "comments": false }".
+Pass Testcase #57, "<svg></svg>", config: "{ "elements": ["svg"] }".
+Pass Testcase #58, "<div><svg></svg></div>", config: "{ "elements": ["div", "svg"] }".
+Pass Testcase #59, "<div>balabala<dl>test</dl></div>", config: "{ "removeElements": ["I", "DL"] }".
+Pass Testcase #60, "<div>balabala<dl>test</dl></div>", config: "{ "removeElements": ["i", "dl"] }".
+Pass Testcase #61, "<DIV>balabala<DL>test</DL></DIV>", config: "{ "removeElements": ["i", "dl"] }".
+Pass Testcase #62, "<p id="test">Click.</p>", config: "{ "removeAttributes": ["ID"] }".
+Pass Testcase #63, "<p ID="test">Click.</p>", config: "{ "removeAttributes": ["ID"] }".
+Pass Testcase #64, "<p ID="test">Click.</p>", config: "{ "removeAttributes": ["id"] }".
+Pass Testcase #65, "<div>balabala<i>test</i></div><test>t</test><custom-element>custom-element</custom-element>", config: "{ "removeElements": [123, "test", "i", "custom-element"] }".
+Pass Testcase #66, "<div>balabala<i>test</i></div><test>t</test><custom-element>custom-element</custom-element>", config: "{ "replaceWithChildrenElements": [123, "test", "i", "custom-element"],
+ "elements": ["div"]}".
+Pass Testcase #67, "<div>test<div>p</div>tt<p>div</p></div><test>test</test>", config: "{ "elements": ["p", "test"], "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #68, "test<div>p</div>tt<p>div</p><test>test</test>", config: "{ "elements": ["p", "test"], "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #69, "<div hello='1' world='2'><b hello='3' world='4'>", config: "{ "elements": ["div", "b"], "attributes": ["hello", "world"] }".
+Pass Testcase #70, "<div hello='1' world='2'><b hello='3' world='4'>", config: "{ "elements": ["div", "b"], "removeAttributes": ["hello", "world"] }".
+Pass Testcase #71, "<table><div><td>", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #72, "<template><div>Hello</div></template>", config: "{}".
+Pass Testcase #73, "<template><div>Hello</div></template>", config: "{ "elements": ["div"]}".
+Pass Testcase #74, "<template><div>Hello</div></template>", config: "{ "elements": ["template"]}".
+Pass Testcase #75, "<template><div>Hello</div></template>", config: "{ "elements": ["div", "template"]}".
+Pass Testcase #76, "<template><div>Hello</div></template>", config: "{ "elements": ["template"], "replaceWithChildrenElements": ["div"]}".
+Pass Testcase #77, "<a href="about:blank" rel="opener">Click.</a>", config: "undefined".
+Pass Testcase #78, "<div><b><em><foo><foob><fooc><aside></b></em></div>", config: "{ "removeElements": ["em"] }".
+Pass Testcase #79, "<template><b>Hello</b></template>", config: "{ "replaceWithChildrenElements": ["template"] }".
+Pass Testcase #80, "<div><template><b>Hello</b></template>after</div>", config: "{ "replaceWithChildrenElements": ["template"] }".
+Pass Testcase #81, "<b>before</b><template><span>A</span><template><i>nested</i></template></template><b>after</b>", config: "{ "replaceWithChildrenElements": ["template"] }".
+Pass Testcase #82, "<table><template><span>A</span></template><td>cell</td></table>", config: "{ "replaceWithChildrenElements": ["template"] }".
+Pass Testcase #83, "<div><div><b>Hello</b></div>after</div>", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #84, "<div><table><tr>foster<td>cell</td></tr></table></div>", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #85, "<table><div><span>Content</span></div><td>cell</td></table>", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #86, "<table><tr><div><span>Content</span></div><td>cell</td></tr></table>", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #87, "<table>x<tr><td>y", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #88, "<table><tr><td>y</td></tr>x</table>", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #89, "<table><tr><td>y</td></tr><div>x</div></table>", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #90, "a<table><tr><td>y</td></tr>b</table>c", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #91, "<table><tbody><tr><td>y</td></tr>x</table>", config: "{ "replaceWithChildrenElements": ["table", "tbody"] }".
+Pass Testcase #92, "<table><tr><div>x</div><td>y", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #93, "<table>a<b>y</b>c<tr><td>z", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #94, "<table><template>x</template><tr><td>y", config: "{ "replaceWithChildrenElements": ["template"] }".
+Pass Testcase #95, "<template><table>x</table></template>", config: "{ "replaceWithChildrenElements": ["table"] }".
+Pass Testcase #96, "a<table>b<tr><td>c</table>d", config: "{ "removeElements": ["table"] }".
+Pass Testcase #97, "<table><tr>x<td>y", config: "{ "removeElements": ["tr"] }".
+Pass Testcase #98, "<div><table>x", config: "{ "removeElements": ["div"] }".
+Pass Testcase #99, "<b><table>x", config: "{ "replaceWithChildrenElements": ["b"] }".
+Pass Testcase #100, "<b><table><div>x", config: "{ "replaceWithChildrenElements": ["b"], "removeElements": ["table"] }".
+Pass Testcase #101, "<table><div><input type="hidden"><td>x", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #102, "<table><div><template>t</template><td>x", config: "{ "replaceWithChildrenElements": ["div"] }".
+Pass Testcase #103, "<table><div><!-- c --><td>x", config: "{ "replaceWithChildrenElements": ["div"], "comments": true }".
+Pass Testcase #104, "<table><tr><td>y", config: "{ "replaceWithChildrenElements": ["tr"] }".
+Pass Testcase #105, "<table><!-- x --><tr><td>y", config: "{ "replaceWithChildrenElements": ["table"], "comments": true }".
+Pass Testcase #106, "<template><!-- x --></template>", config: "{ "comments": true }".
+Pass Testcase #107, "<td>a</td><div>b</div>", config: "{ "replaceWithChildrenElements": ["td"] }".
+Pass Testcase #108, "<select><option>a<option>b</select>", config: "{ "replaceWithChildrenElements": ["option"] }".
+Pass Testcase #109, "<select><option>a</option></select>", config: "{ "replaceWithChildrenElements": ["select"] }".
+Pass Testcase #110, "<title>a&amp;b<b></title>c", config: "{ "replaceWithChildrenElements": ["title"] }".
+Pass Testcase #111, "<plaintext>x</plaintext>y", config: "{ "replaceWithChildrenElements": ["plaintext"] }".
+Pass Testcase #112, "<xmp><b>x</xmp>y", config: "{ "removeElements": ["xmp"] }".
+Pass Testcase #113, "<image src="x">", config: "{ "removeElements": ["image"] }".
+Pass Testcase #114, "<image src="x">", config: "{ "elements": ["img"] }".
+Pass Testcase #115, "<table><tr><td>x", config: "{ "replaceWithChildrenElements": ["tbody"] }".
+Pass Testcase #116, "<table><col></table>", config: "{ "replaceWithChildrenElements": ["colgroup"] }".
+Pass Testcase #117, "<p>a<div>b</div>c", config: "{ "removeElements": ["p"] }".
+Pass Testcase #118, "<svg><g><rect></g></svg>", config: "{ "replaceWithChildrenElements": [{ "name": "g", "namespace": "http://www.w3.org/2000/svg" }] }".
+Pass Testcase #119, "<svg><foreignObject><div>x</div></foreignObject></svg>", config: "{ "replaceWithChildrenElements": [{ "name": "foreignObject", "namespace": "http://www.w3.org/2000/svg" }] }".
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-custom-elements.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-custom-elements.txt
index c27eabfc481..2c66bd6d158 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-custom-elements.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-custom-elements.txt
@@ -2,29 +2,28 @@ Harness status: OK
Found 24 tests
-2 Pass
-22 Fail
-Fail Custom element that is removed during sanitization.
-Fail Custom element that is allowed.
-Fail Custom element that is allowed, on a disconnected element.
+24 Pass
+Pass Custom element that is removed during sanitization.
+Pass Custom element that is allowed.
+Pass Custom element that is allowed, on a disconnected element.
Pass Custom element on a disconnected element, setHTMLUnsafe().
-Fail Custom element inside an element that is replaced with its children, on a disconnected element, setHTML().
-Fail Custom element inside nested elements that are replaced with their children, setHTML().
-Fail Custom element inside an element that is replaced with its children uses the target's scoped registry, setHTML().
-Fail Custom element inside an element that is replaced with its children, on a disconnected element, setHTMLUnsafe().
-Fail Custom element inside nested elements that are replaced with their children, setHTMLUnsafe().
-Fail Custom element inside an element that is replaced with its children uses the target's scoped registry, setHTMLUnsafe().
-Fail Custom element in a declarative shadow root on a removed host is not constructed.
-Fail Custom element inside a removed element is not constructed.
-Fail attributeChangedCallback only fires for attributes the sanitizer keeps.
-Fail Custom element via is-attribute, where is attribute is not default-allowed.
-Fail Custom element via is-attribute, where is attribute is removed.
-Fail Custom element via is-attribute, where is attribute is removed but the custom element would have been allowed.
-Fail Custom element with an is-attribute, where the is=-attribute is blocked.
-Fail Custom element via is-attribute, where is attribute is allowed, but the element is not.
-Fail Custom element via is-attribute, where is attribute is allowed, but the element is removed.
-Fail Custom element via is-attribute, where is attribute is allowed, but the element is replaced.
-Fail Custom element via is-attribute with unsafe, where is attribute is not default-allowed.
-Fail Sanity check, that is= processing still works when allowed.
-Fail Custom element via is-attribute on script element, where is attribute is not allowed.
+Pass Custom element inside an element that is replaced with its children, on a disconnected element, setHTML().
+Pass Custom element inside nested elements that are replaced with their children, setHTML().
+Pass Custom element inside an element that is replaced with its children uses the target's scoped registry, setHTML().
+Pass Custom element inside an element that is replaced with its children, on a disconnected element, setHTMLUnsafe().
+Pass Custom element inside nested elements that are replaced with their children, setHTMLUnsafe().
+Pass Custom element inside an element that is replaced with its children uses the target's scoped registry, setHTMLUnsafe().
+Pass Custom element in a declarative shadow root on a removed host is not constructed.
+Pass Custom element inside a removed element is not constructed.
+Pass attributeChangedCallback only fires for attributes the sanitizer keeps.
+Pass Custom element via is-attribute, where is attribute is not default-allowed.
+Pass Custom element via is-attribute, where is attribute is removed.
+Pass Custom element via is-attribute, where is attribute is removed but the custom element would have been allowed.
+Pass Custom element with an is-attribute, where the is=-attribute is blocked.
+Pass Custom element via is-attribute, where is attribute is allowed, but the element is not.
+Pass Custom element via is-attribute, where is attribute is allowed, but the element is removed.
+Pass Custom element via is-attribute, where is attribute is allowed, but the element is replaced.
+Pass Custom element via is-attribute with unsafe, where is attribute is not default-allowed.
+Pass Sanity check, that is= processing still works when allowed.
+Pass Custom element via is-attribute on script element, where is attribute is not allowed.
Pass Custom element via is-attribute on html element, where is attribute is not default-allowed.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-declarative-shadow-root.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-declarative-shadow-root.txt
index 36327452d68..4e53ca47514 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-declarative-shadow-root.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-declarative-shadow-root.txt
@@ -2,19 +2,19 @@ Harness status: OK
Found 14 tests
-1 Pass
-13 Fail
-Fail template with shadowrootmode should be removed by safe default
+13 Pass
+1 Fail
+Pass template with shadowrootmode should be removed by safe default
Pass template with shadowrootmode should not be removed in unsafe mode
-Fail template with shadowrootmode should not be processed when <template> is forbidden
-Fail template with shadowrootmode should be processed as a normal template when the shadowRootMode attribute is forbidden
-Fail template with shadowrootmode replaced with its children has no children in the tree
-Fail declarative shadow root on a host replaced with its children is not attached to the parent; the template is kept as a regular template
-Fail declarative shadow root on a removed host is dropped with it
-Fail template with shadowrootmode in removeElements does not attach a shadow root (setHTMLUnsafe)
-Fail shadowRoot.delegatesFocus does not propagate to the shadow root when shadowrootdelegatesfocus is removed by sanitizer
-Fail shadowRoot.serializable does not propagate to the shadow root when shadowrootserializable is removed by sanitizer
-Fail shadowRoot.clonable does not propagate to the shadow root when shadowrootclonable is removed by sanitizer
+Pass template with shadowrootmode should not be processed when <template> is forbidden
+Pass template with shadowrootmode should be processed as a normal template when the shadowRootMode attribute is forbidden
+Pass template with shadowrootmode replaced with its children has no children in the tree
+Pass declarative shadow root on a host replaced with its children is not attached to the parent; the template is kept as a regular template
+Pass declarative shadow root on a removed host is dropped with it
+Pass template with shadowrootmode in removeElements does not attach a shadow root (setHTMLUnsafe)
+Pass shadowRoot.delegatesFocus does not propagate to the shadow root when shadowrootdelegatesfocus is removed by sanitizer
+Pass shadowRoot.serializable does not propagate to the shadow root when shadowrootserializable is removed by sanitizer
+Pass shadowRoot.clonable does not propagate to the shadow root when shadowrootclonable is removed by sanitizer
Fail shadowRoot.referenceTarget does not propagate to the shadow root when shadowrootreferencetarget is removed by sanitizer
-Fail shadowRoot.customElementRegistry does not propagate to the shadow root when shadowrootcustomelementregistry is removed by sanitizer
-Fail shadowRoot.adoptedStyleSheets does not propagate to the shadow root when shadowrootadoptedstylesheets is removed by sanitizer
\ No newline at end of file
+Pass shadowRoot.customElementRegistry does not propagate to the shadow root when shadowrootcustomelementregistry is removed by sanitizer
+Pass shadowRoot.adoptedStyleSheets does not propagate to the shadow root when shadowrootadoptedstylesheets is removed by sanitizer
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedhtml-createParserOptions.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedhtml-createParserOptions.txt
index 082abdb7901..d50196a66cd 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedhtml-createParserOptions.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedhtml-createParserOptions.txt
@@ -2,171 +2,170 @@ Harness status: OK
Found 166 tests
-32 Pass
-134 Fail
-Fail ShadowRoot.setHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+166 Pass
+Pass ShadowRoot.setHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass ShadowRoot.setHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail ShadowRoot.setHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail ShadowRoot.setHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.setHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.appendHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail ShadowRoot.appendHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail ShadowRoot.appendHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass ShadowRoot.setHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass ShadowRoot.setHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass ShadowRoot.setHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass ShadowRoot.appendHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass ShadowRoot.appendHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass ShadowRoot.appendHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass ShadowRoot.appendHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass ShadowRoot.appendHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.prependHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail ShadowRoot.prependHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail ShadowRoot.prependHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass ShadowRoot.prependHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass ShadowRoot.prependHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass ShadowRoot.prependHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass ShadowRoot.prependHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass ShadowRoot.prependHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.innerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass ShadowRoot.innerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass ShadowRoot.innerHTML: sending TrustedHTML does not call default policy createHTML
-Fail ShadowRoot.innerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail ShadowRoot.innerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.innerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail ShadowRoot.setHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail ShadowRoot.setHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail ShadowRoot.setHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass ShadowRoot.innerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass ShadowRoot.innerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass ShadowRoot.innerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass ShadowRoot.setHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass ShadowRoot.setHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail ShadowRoot.setHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail ShadowRoot.setHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail ShadowRoot.appendHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail ShadowRoot.appendHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail ShadowRoot.appendHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail ShadowRoot.prependHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail ShadowRoot.prependHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail ShadowRoot.prependHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail ShadowRoot.innerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.setHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass ShadowRoot.setHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass ShadowRoot.appendHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass ShadowRoot.appendHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass ShadowRoot.appendHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass ShadowRoot.prependHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass ShadowRoot.prependHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass ShadowRoot.prependHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass ShadowRoot.innerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.setHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.setHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.setHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.setHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.setHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.appendHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail Element.appendHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.appendHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.setHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.setHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.setHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.appendHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.appendHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass Element.appendHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass Element.appendHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass Element.appendHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.prependHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail Element.prependHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.prependHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.prependHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.prependHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass Element.prependHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass Element.prependHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass Element.prependHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.beforeHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail Element.beforeHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.beforeHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.beforeHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.beforeHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass Element.beforeHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass Element.beforeHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass Element.beforeHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.afterHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail Element.afterHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.afterHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.afterHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.afterHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass Element.afterHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass Element.afterHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass Element.afterHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.replaceWithHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
-Fail Element.replaceWithHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.replaceWithHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.replaceWithHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.replaceWithHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
+Pass Element.replaceWithHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
Pass Element.replaceWithHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
Pass Element.replaceWithHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.innerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.innerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.innerHTML: sending TrustedHTML does not call default policy createHTML
-Fail Element.innerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.innerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.innerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.outerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.innerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.innerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.innerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.outerHTML: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.outerHTML: sending TrustedHTML does not call default policy createHTML
-Fail Element.outerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.outerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.outerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.createContextualFragment: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.outerHTML: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.outerHTML: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.outerHTML: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.createContextualFragment: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.createContextualFragment: sending TrustedHTML does not call default policy createHTML
-Fail Element.createContextualFragment: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.createContextualFragment: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.createContextualFragment: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.afterbegin: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.createContextualFragment: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.createContextualFragment: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.createContextualFragment: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.afterbegin: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.afterbegin: sending TrustedHTML does not call default policy createHTML
-Fail Element.afterbegin: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.afterbegin: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.afterbegin: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.beforeend: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.afterbegin: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.afterbegin: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.afterbegin: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.beforeend: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.beforeend: sending TrustedHTML does not call default policy createHTML
-Fail Element.beforeend: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.beforeend: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.beforeend: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.beforebegin: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.beforeend: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.beforeend: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.beforeend: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.beforebegin: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.beforebegin: sending TrustedHTML does not call default policy createHTML
-Fail Element.beforebegin: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.beforebegin: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.beforebegin: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.afterend: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.beforebegin: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.beforebegin: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.beforebegin: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.afterend: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.afterend: sending TrustedHTML does not call default policy createHTML
-Fail Element.afterend: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.afterend: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.afterend: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.parseHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
+Pass Element.afterend: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.afterend: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.afterend: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.parseHTMLUnsafe: sending TrustedHTML applies sanitizer in default policy createParserOptions
Pass Element.parseHTMLUnsafe: sending TrustedHTML does not call default policy createHTML
-Fail Element.parseHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
-Fail Element.parseHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
-Fail Element.parseHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
-Fail Element.setHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.setHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.setHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.parseHTMLUnsafe: exception in default createParserOptions rethrows when TrustedHTML is passed
+Pass Element.parseHTMLUnsafe: default createParserOptions returning null throws TypeError when TrustedHTML is passed
+Pass Element.parseHTMLUnsafe: default createParserOptions returning undefined throws TypeError when TrustedHTML is passed
+Pass Element.setHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.setHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.setHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
Pass Element.setHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.setHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.setHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.appendHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.appendHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.appendHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail Element.appendHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.appendHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.appendHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.prependHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.prependHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.prependHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail Element.prependHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.prependHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.prependHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.beforeHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.beforeHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.beforeHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.afterHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.afterHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.afterHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail Element.afterHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.afterHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.afterHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Element.replaceWithHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Element.replaceWithHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions can disable runScripts
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions can enable runScripts
-Fail Element.replaceWithHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
-Fail Element.innerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.outerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.afterbegin: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.beforeend: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.beforebegin: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
-Fail Element.afterend: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.setHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.setHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.appendHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.appendHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.appendHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.appendHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass Element.appendHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.appendHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.prependHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.prependHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.prependHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.prependHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass Element.prependHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.prependHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.beforeHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.beforeHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.beforeHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.afterHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.afterHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.afterHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.afterHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass Element.afterHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.afterHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Element.replaceWithHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Element.replaceWithHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions can disable runScripts
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions can enable runScripts
+Pass Element.replaceWithHTMLUnsafe: TrustedHTML runs scripts when caller requests runScripts and default policy allows it
+Pass Element.innerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.outerHTML: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.afterbegin: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.beforeend: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.beforebegin: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
+Pass Element.afterend: default policy createParserOptions returning {runScripts: true} enables script execution with TrustedHTML
Pass Element: createContextualFragment with TrustedHTML and createParserOptions(runScripts=false) does not run scripts
-Fail Element: createContextualFragment with TrustedHTML runs scripts by default
-Fail Document.parseHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
-Fail Document.parseHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
-Fail Document.parseHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
+Pass Element: createContextualFragment with TrustedHTML runs scripts by default
+Pass Document.parseHTMLUnsafe: default policy createParserOptions sanitizer overrides caller sanitizer dictionary with TrustedHTML
+Pass Document.parseHTMLUnsafe: caller-provided sanitizer dictionary is applied with TrustedHTML when default policy passes it through
+Pass Document.parseHTMLUnsafe: caller-provided TrustedHTMLParserOptions sanitizer is applied with TrustedHTML while default policy is bypassed
Pass innerHTML on XML document does not call createParserOptions or throw TypeError when TrustedHTML is passed
Pass outerHTML on XML document does not call createParserOptions or throw TypeError when TrustedHTML is passed
Pass insertAdjacentHTML on XML document does not call createParserOptions or throw TypeError when TrustedHTML is passed
Pass createContextualFragment on XML document does not call createParserOptions or throw TypeError when TrustedHTML is passed
-Fail setHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
-Fail appendHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
-Fail prependHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
-Fail beforeHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
-Fail afterHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
-Fail replaceWithHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
\ No newline at end of file
+Pass setHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
+Pass appendHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
+Pass prependHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
+Pass beforeHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
+Pass afterHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
+Pass replaceWithHTMLUnsafe on XML document calls createParserOptions and applies sanitizer when TrustedHTML is passed
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-createParserOptions.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-createParserOptions.txt
index 375efa19ac7..490b10aefe3 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-createParserOptions.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-createParserOptions.txt
@@ -2,102 +2,101 @@ Harness status: OK
Found 97 tests
-8 Pass
-89 Fail
-Fail ShadowRoot.setHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail ShadowRoot.setHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail ShadowRoot.setHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail ShadowRoot.setHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail ShadowRoot.setHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail ShadowRoot.setHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.setHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail ShadowRoot.setHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+97 Pass
+Pass ShadowRoot.setHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass ShadowRoot.setHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass ShadowRoot.setHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass ShadowRoot.setHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass ShadowRoot.setHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
Pass ShadowRoot.setHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail ShadowRoot.appendHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail ShadowRoot.appendHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail ShadowRoot.appendHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail ShadowRoot.appendHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail ShadowRoot.appendHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail ShadowRoot.prependHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail ShadowRoot.prependHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail ShadowRoot.prependHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail ShadowRoot.prependHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail ShadowRoot.prependHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.setHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.setHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.setHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.setHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.setHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.setHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.setHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.setHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass ShadowRoot.appendHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass ShadowRoot.appendHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass ShadowRoot.appendHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass ShadowRoot.appendHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass ShadowRoot.appendHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass ShadowRoot.appendHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass ShadowRoot.prependHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass ShadowRoot.prependHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass ShadowRoot.prependHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass ShadowRoot.prependHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass ShadowRoot.prependHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass ShadowRoot.prependHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass Element.setHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.setHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.setHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.setHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.setHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.setHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.setHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.setHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
Pass Element.setHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.appendHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.appendHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.appendHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.appendHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.appendHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.appendHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.appendHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.appendHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail Element.appendHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.prependHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.prependHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.prependHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.prependHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.prependHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.prependHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.prependHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.prependHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail Element.prependHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.beforeHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.beforeHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.beforeHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.beforeHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.beforeHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail Element.beforeHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.afterHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.afterHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.afterHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.afterHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.afterHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.afterHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.afterHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.afterHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail Element.afterHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail Element.replaceWithHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
-Fail Element.replaceWithHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
-Fail Element.replaceWithHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
-Fail Element.replaceWithHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Element.replaceWithHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
-Fail Element.replaceWithHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
-Fail TrustedTypePolicy.createParserOptions forwards extra arguments to callback
-Fail TrustedTypePolicy.createParserOptions callback receives converted options dictionary
-Fail TrustedHTMLParserOptions applies runScripts option without exposing public members
+Pass Element.appendHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.appendHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.appendHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.appendHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.appendHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.appendHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.appendHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.appendHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass Element.appendHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass Element.prependHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.prependHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.prependHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.prependHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.prependHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.prependHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.prependHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.prependHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass Element.prependHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass Element.beforeHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.beforeHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.beforeHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.beforeHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.beforeHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass Element.beforeHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass Element.afterHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.afterHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.afterHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.afterHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.afterHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.afterHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.afterHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.afterHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass Element.afterHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass Element.replaceWithHTMLUnsafe: passing a TrustedHTMLParserOptions overrides default policy
+Pass Element.replaceWithHTMLUnsafe: policy with only createParserOptions allows raw strings when sanitizer is present
+Pass Element.replaceWithHTMLUnsafe: policy with only createParserOptions allows raw strings without sanitizer
+Pass Element.replaceWithHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Element.replaceWithHTMLUnsafe: exception in default createParserOptions prevents createHTML from running
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions with sanitizer prevents createHTML from running
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions can override runScripts from false to true
+Pass Element.replaceWithHTMLUnsafe: default policy createParserOptions can override runScripts from true to false
+Pass TrustedTypePolicy.createParserOptions forwards extra arguments to callback
+Pass TrustedTypePolicy.createParserOptions callback receives converted options dictionary
+Pass TrustedHTMLParserOptions applies runScripts option without exposing public members
Pass TrustedTypePolicy.createParserOptions returning something other than an object (number: 0) throws a TypeError
-Fail Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (number: 0) throws a TypeError
+Pass Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (number: 0) throws a TypeError
Pass TrustedTypePolicy.createParserOptions returning something other than an object (number: 123) throws a TypeError
-Fail Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (number: 123) throws a TypeError
+Pass Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (number: 123) throws a TypeError
Pass TrustedTypePolicy.createParserOptions returning something other than an object (boolean: true) throws a TypeError
-Fail Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (boolean: true) throws a TypeError
+Pass Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (boolean: true) throws a TypeError
Pass TrustedTypePolicy.createParserOptions returning something other than an object (boolean: false) throws a TypeError
-Fail Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (boolean: false) throws a TypeError
+Pass Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (boolean: false) throws a TypeError
Pass TrustedTypePolicy.createParserOptions returning something other than an object (string: "string") throws a TypeError
-Fail Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (string: "string") throws a TypeError
-Fail Document.parseHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
-Fail Document.parseHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
+Pass Element.setHTMLUnsafe: default policy createParserOptions returning something other than an object (string: "string") throws a TypeError
+Pass Document.parseHTMLUnsafe: TrustedHTMLParserOptions without sanitizer satisfies Trusted Types and does not require createHTML
+Pass Document.parseHTMLUnsafe: default policy createParserOptions without sanitizer prevents createHTML from running
Pass Element.setHTMLUnsafe: default policy without createParserOptions falls back to createHTML
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-immutable.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-immutable.txt
index c8817beacf5..c89a6af32d5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-immutable.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes-immutable.txt
@@ -2,20 +2,20 @@ Harness status: OK
Found 16 tests
-16 Fail
-Fail setHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail setHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail appendHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail appendHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail prependHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail prependHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail beforeHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail beforeHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail afterHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail afterHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail replaceWithHTMLUnsafe: createParserOptions doesn't mutate original object
-Fail replaceWithHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
-Fail TrustedHTMLParserOptions interface has no public members
-Fail TrustedHTMLParserOptions with config input applies sanitization without public members
-Fail TrustedHTMLParserOptions clone testing with Sanitizer object input
-Fail TrustedHTMLParserOptions with Preset string input
\ No newline at end of file
+16 Pass
+Pass setHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass setHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass appendHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass appendHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass prependHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass prependHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass beforeHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass beforeHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass afterHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass afterHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass replaceWithHTMLUnsafe: createParserOptions doesn't mutate original object
+Pass replaceWithHTMLUnsafe: createParserOptions doesn't mutate sanitizer object
+Pass TrustedHTMLParserOptions interface has no public members
+Pass TrustedHTMLParserOptions with config input applies sanitization without public members
+Pass TrustedHTMLParserOptions clone testing with Sanitizer object input
+Pass TrustedHTMLParserOptions with Preset string input
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes.txt
index bffddc4eff8..19ecfb081a7 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-with-trustedtypes.txt
@@ -2,25 +2,24 @@ Harness status: OK
Found 253 tests
-55 Pass
-198 Fail
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions can override a sanitizer config
+253 Pass
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions can override a sanitizer config
Pass ShadowRoot.setHTMLUnsafe: createParserOptions can remove a sanitizer
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning null fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning undefined fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning 0 fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning 123 fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning "foo" fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning true fails
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions returning false fails
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning null fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning undefined fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning 0 fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning 123 fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning "foo" fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning true fails
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions returning false fails
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can remove a sanitizer
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning null fails
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning undefined fails
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning 0 fails
@@ -28,11 +27,11 @@ Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning 123 fails
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning "foo" fails
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning true fails
Pass ShadowRoot.appendHTMLUnsafe: createParserOptions returning false fails
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can remove a sanitizer
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning null fails
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning undefined fails
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning 0 fails
@@ -40,47 +39,47 @@ Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning 123 fails
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning "foo" fails
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning true fails
Pass ShadowRoot.prependHTMLUnsafe: createParserOptions returning false fails
-Fail ShadowRoot.innerHTML: createParserOptions can inject a sanitizer config
-Fail ShadowRoot.innerHTML: createParserOptions receives correct type and sink name
-Fail ShadowRoot.innerHTML: createParserOptions can inject a sanitizer
-Fail ShadowRoot.innerHTML: createParserOptions returning null fails
-Fail ShadowRoot.innerHTML: createParserOptions returning undefined fails
-Fail ShadowRoot.innerHTML: createParserOptions returning 0 fails
-Fail ShadowRoot.innerHTML: createParserOptions returning 123 fails
-Fail ShadowRoot.innerHTML: createParserOptions returning "foo" fails
-Fail ShadowRoot.innerHTML: createParserOptions returning true fails
-Fail ShadowRoot.innerHTML: createParserOptions returning false fails
+Pass ShadowRoot.innerHTML: createParserOptions can inject a sanitizer config
+Pass ShadowRoot.innerHTML: createParserOptions receives correct type and sink name
+Pass ShadowRoot.innerHTML: createParserOptions can inject a sanitizer
+Pass ShadowRoot.innerHTML: createParserOptions returning null fails
+Pass ShadowRoot.innerHTML: createParserOptions returning undefined fails
+Pass ShadowRoot.innerHTML: createParserOptions returning 0 fails
+Pass ShadowRoot.innerHTML: createParserOptions returning 123 fails
+Pass ShadowRoot.innerHTML: createParserOptions returning "foo" fails
+Pass ShadowRoot.innerHTML: createParserOptions returning true fails
+Pass ShadowRoot.innerHTML: createParserOptions returning false fails
Pass ShadowRoot.setHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail ShadowRoot.setHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail ShadowRoot.appendHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail ShadowRoot.prependHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail ShadowRoot.innerHTML: createParserOptions returning {runScripts: true} enables script execution
-Fail ShadowRoot.setHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail ShadowRoot.appendHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail ShadowRoot.prependHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail ShadowRoot.innerHTML: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.setHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.setHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.setHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.setHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass ShadowRoot.setHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass ShadowRoot.appendHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass ShadowRoot.prependHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass ShadowRoot.innerHTML: createParserOptions returning {runScripts: true} enables script execution
+Pass ShadowRoot.setHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass ShadowRoot.appendHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass ShadowRoot.prependHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass ShadowRoot.innerHTML: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.setHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.setHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.setHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.setHTMLUnsafe: createParserOptions can override a sanitizer config
Pass Element.setHTMLUnsafe: createParserOptions can remove a sanitizer
-Fail Element.setHTMLUnsafe: createParserOptions returning null fails
-Fail Element.setHTMLUnsafe: createParserOptions returning undefined fails
-Fail Element.setHTMLUnsafe: createParserOptions returning 0 fails
-Fail Element.setHTMLUnsafe: createParserOptions returning 123 fails
-Fail Element.setHTMLUnsafe: createParserOptions returning "foo" fails
-Fail Element.setHTMLUnsafe: createParserOptions returning true fails
-Fail Element.setHTMLUnsafe: createParserOptions returning false fails
-Fail Element.appendHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.appendHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.appendHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.appendHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail Element.appendHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass Element.setHTMLUnsafe: createParserOptions returning null fails
+Pass Element.setHTMLUnsafe: createParserOptions returning undefined fails
+Pass Element.setHTMLUnsafe: createParserOptions returning 0 fails
+Pass Element.setHTMLUnsafe: createParserOptions returning 123 fails
+Pass Element.setHTMLUnsafe: createParserOptions returning "foo" fails
+Pass Element.setHTMLUnsafe: createParserOptions returning true fails
+Pass Element.setHTMLUnsafe: createParserOptions returning false fails
+Pass Element.appendHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.appendHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.appendHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.appendHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.appendHTMLUnsafe: createParserOptions can remove a sanitizer
Pass Element.appendHTMLUnsafe: createParserOptions returning null fails
Pass Element.appendHTMLUnsafe: createParserOptions returning undefined fails
Pass Element.appendHTMLUnsafe: createParserOptions returning 0 fails
@@ -88,11 +87,11 @@ Pass Element.appendHTMLUnsafe: createParserOptions returning 123 fails
Pass Element.appendHTMLUnsafe: createParserOptions returning "foo" fails
Pass Element.appendHTMLUnsafe: createParserOptions returning true fails
Pass Element.appendHTMLUnsafe: createParserOptions returning false fails
-Fail Element.prependHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.prependHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.prependHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.prependHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail Element.prependHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass Element.prependHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.prependHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.prependHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.prependHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.prependHTMLUnsafe: createParserOptions can remove a sanitizer
Pass Element.prependHTMLUnsafe: createParserOptions returning null fails
Pass Element.prependHTMLUnsafe: createParserOptions returning undefined fails
Pass Element.prependHTMLUnsafe: createParserOptions returning 0 fails
@@ -100,11 +99,11 @@ Pass Element.prependHTMLUnsafe: createParserOptions returning 123 fails
Pass Element.prependHTMLUnsafe: createParserOptions returning "foo" fails
Pass Element.prependHTMLUnsafe: createParserOptions returning true fails
Pass Element.prependHTMLUnsafe: createParserOptions returning false fails
-Fail Element.beforeHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.beforeHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.beforeHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.beforeHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail Element.beforeHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass Element.beforeHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.beforeHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.beforeHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.beforeHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.beforeHTMLUnsafe: createParserOptions can remove a sanitizer
Pass Element.beforeHTMLUnsafe: createParserOptions returning null fails
Pass Element.beforeHTMLUnsafe: createParserOptions returning undefined fails
Pass Element.beforeHTMLUnsafe: createParserOptions returning 0 fails
@@ -112,11 +111,11 @@ Pass Element.beforeHTMLUnsafe: createParserOptions returning 123 fails
Pass Element.beforeHTMLUnsafe: createParserOptions returning "foo" fails
Pass Element.beforeHTMLUnsafe: createParserOptions returning true fails
Pass Element.beforeHTMLUnsafe: createParserOptions returning false fails
-Fail Element.afterHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.afterHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.afterHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.afterHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail Element.afterHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass Element.afterHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.afterHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.afterHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.afterHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.afterHTMLUnsafe: createParserOptions can remove a sanitizer
Pass Element.afterHTMLUnsafe: createParserOptions returning null fails
Pass Element.afterHTMLUnsafe: createParserOptions returning undefined fails
Pass Element.afterHTMLUnsafe: createParserOptions returning 0 fails
@@ -124,11 +123,11 @@ Pass Element.afterHTMLUnsafe: createParserOptions returning 123 fails
Pass Element.afterHTMLUnsafe: createParserOptions returning "foo" fails
Pass Element.afterHTMLUnsafe: createParserOptions returning true fails
Pass Element.afterHTMLUnsafe: createParserOptions returning false fails
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.replaceWithHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can override a sanitizer config
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can remove a sanitizer
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.replaceWithHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can remove a sanitizer
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning null fails
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning undefined fails
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning 0 fails
@@ -136,124 +135,124 @@ Pass Element.replaceWithHTMLUnsafe: createParserOptions returning 123 fails
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning "foo" fails
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning true fails
Pass Element.replaceWithHTMLUnsafe: createParserOptions returning false fails
-Fail Element.innerHTML: createParserOptions can inject a sanitizer config
-Fail Element.innerHTML: createParserOptions receives correct type and sink name
-Fail Element.innerHTML: createParserOptions can inject a sanitizer
-Fail Element.innerHTML: createParserOptions returning null fails
-Fail Element.innerHTML: createParserOptions returning undefined fails
-Fail Element.innerHTML: createParserOptions returning 0 fails
-Fail Element.innerHTML: createParserOptions returning 123 fails
-Fail Element.innerHTML: createParserOptions returning "foo" fails
-Fail Element.innerHTML: createParserOptions returning true fails
-Fail Element.innerHTML: createParserOptions returning false fails
-Fail Element.outerHTML: createParserOptions can inject a sanitizer config
-Fail Element.outerHTML: createParserOptions receives correct type and sink name
-Fail Element.outerHTML: createParserOptions can inject a sanitizer
-Fail Element.outerHTML: createParserOptions returning null fails
-Fail Element.outerHTML: createParserOptions returning undefined fails
-Fail Element.outerHTML: createParserOptions returning 0 fails
-Fail Element.outerHTML: createParserOptions returning 123 fails
-Fail Element.outerHTML: createParserOptions returning "foo" fails
-Fail Element.outerHTML: createParserOptions returning true fails
-Fail Element.outerHTML: createParserOptions returning false fails
-Fail Element.createContextualFragment: createParserOptions can inject a sanitizer config
-Fail Element.createContextualFragment: createParserOptions receives correct type and sink name
-Fail Element.createContextualFragment: createParserOptions can inject a sanitizer
-Fail Element.createContextualFragment: createParserOptions returning null fails
-Fail Element.createContextualFragment: createParserOptions returning undefined fails
-Fail Element.createContextualFragment: createParserOptions returning 0 fails
-Fail Element.createContextualFragment: createParserOptions returning 123 fails
-Fail Element.createContextualFragment: createParserOptions returning "foo" fails
-Fail Element.createContextualFragment: createParserOptions returning true fails
-Fail Element.createContextualFragment: createParserOptions returning false fails
-Fail Element.afterbegin: createParserOptions can inject a sanitizer config
-Fail Element.afterbegin: createParserOptions receives correct type and sink name
-Fail Element.afterbegin: createParserOptions can inject a sanitizer
-Fail Element.afterbegin: createParserOptions returning null fails
-Fail Element.afterbegin: createParserOptions returning undefined fails
-Fail Element.afterbegin: createParserOptions returning 0 fails
-Fail Element.afterbegin: createParserOptions returning 123 fails
-Fail Element.afterbegin: createParserOptions returning "foo" fails
-Fail Element.afterbegin: createParserOptions returning true fails
-Fail Element.afterbegin: createParserOptions returning false fails
-Fail Element.beforeend: createParserOptions can inject a sanitizer config
-Fail Element.beforeend: createParserOptions receives correct type and sink name
-Fail Element.beforeend: createParserOptions can inject a sanitizer
-Fail Element.beforeend: createParserOptions returning null fails
-Fail Element.beforeend: createParserOptions returning undefined fails
-Fail Element.beforeend: createParserOptions returning 0 fails
-Fail Element.beforeend: createParserOptions returning 123 fails
-Fail Element.beforeend: createParserOptions returning "foo" fails
-Fail Element.beforeend: createParserOptions returning true fails
-Fail Element.beforeend: createParserOptions returning false fails
-Fail Element.beforebegin: createParserOptions can inject a sanitizer config
-Fail Element.beforebegin: createParserOptions receives correct type and sink name
-Fail Element.beforebegin: createParserOptions can inject a sanitizer
-Fail Element.beforebegin: createParserOptions returning null fails
-Fail Element.beforebegin: createParserOptions returning undefined fails
-Fail Element.beforebegin: createParserOptions returning 0 fails
-Fail Element.beforebegin: createParserOptions returning 123 fails
-Fail Element.beforebegin: createParserOptions returning "foo" fails
-Fail Element.beforebegin: createParserOptions returning true fails
-Fail Element.beforebegin: createParserOptions returning false fails
-Fail Element.afterend: createParserOptions can inject a sanitizer config
-Fail Element.afterend: createParserOptions receives correct type and sink name
-Fail Element.afterend: createParserOptions can inject a sanitizer
-Fail Element.afterend: createParserOptions returning null fails
-Fail Element.afterend: createParserOptions returning undefined fails
-Fail Element.afterend: createParserOptions returning 0 fails
-Fail Element.afterend: createParserOptions returning 123 fails
-Fail Element.afterend: createParserOptions returning "foo" fails
-Fail Element.afterend: createParserOptions returning true fails
-Fail Element.afterend: createParserOptions returning false fails
-Fail Element.parseHTMLUnsafe: createParserOptions can inject a sanitizer config
-Fail Element.parseHTMLUnsafe: createParserOptions receives correct type and sink name
-Fail Element.parseHTMLUnsafe: createParserOptions can inject a sanitizer
-Fail Element.parseHTMLUnsafe: createParserOptions can override a sanitizer config
+Pass Element.innerHTML: createParserOptions can inject a sanitizer config
+Pass Element.innerHTML: createParserOptions receives correct type and sink name
+Pass Element.innerHTML: createParserOptions can inject a sanitizer
+Pass Element.innerHTML: createParserOptions returning null fails
+Pass Element.innerHTML: createParserOptions returning undefined fails
+Pass Element.innerHTML: createParserOptions returning 0 fails
+Pass Element.innerHTML: createParserOptions returning 123 fails
+Pass Element.innerHTML: createParserOptions returning "foo" fails
+Pass Element.innerHTML: createParserOptions returning true fails
+Pass Element.innerHTML: createParserOptions returning false fails
+Pass Element.outerHTML: createParserOptions can inject a sanitizer config
+Pass Element.outerHTML: createParserOptions receives correct type and sink name
+Pass Element.outerHTML: createParserOptions can inject a sanitizer
+Pass Element.outerHTML: createParserOptions returning null fails
+Pass Element.outerHTML: createParserOptions returning undefined fails
+Pass Element.outerHTML: createParserOptions returning 0 fails
+Pass Element.outerHTML: createParserOptions returning 123 fails
+Pass Element.outerHTML: createParserOptions returning "foo" fails
+Pass Element.outerHTML: createParserOptions returning true fails
+Pass Element.outerHTML: createParserOptions returning false fails
+Pass Element.createContextualFragment: createParserOptions can inject a sanitizer config
+Pass Element.createContextualFragment: createParserOptions receives correct type and sink name
+Pass Element.createContextualFragment: createParserOptions can inject a sanitizer
+Pass Element.createContextualFragment: createParserOptions returning null fails
+Pass Element.createContextualFragment: createParserOptions returning undefined fails
+Pass Element.createContextualFragment: createParserOptions returning 0 fails
+Pass Element.createContextualFragment: createParserOptions returning 123 fails
+Pass Element.createContextualFragment: createParserOptions returning "foo" fails
+Pass Element.createContextualFragment: createParserOptions returning true fails
+Pass Element.createContextualFragment: createParserOptions returning false fails
+Pass Element.afterbegin: createParserOptions can inject a sanitizer config
+Pass Element.afterbegin: createParserOptions receives correct type and sink name
+Pass Element.afterbegin: createParserOptions can inject a sanitizer
+Pass Element.afterbegin: createParserOptions returning null fails
+Pass Element.afterbegin: createParserOptions returning undefined fails
+Pass Element.afterbegin: createParserOptions returning 0 fails
+Pass Element.afterbegin: createParserOptions returning 123 fails
+Pass Element.afterbegin: createParserOptions returning "foo" fails
+Pass Element.afterbegin: createParserOptions returning true fails
+Pass Element.afterbegin: createParserOptions returning false fails
+Pass Element.beforeend: createParserOptions can inject a sanitizer config
+Pass Element.beforeend: createParserOptions receives correct type and sink name
+Pass Element.beforeend: createParserOptions can inject a sanitizer
+Pass Element.beforeend: createParserOptions returning null fails
+Pass Element.beforeend: createParserOptions returning undefined fails
+Pass Element.beforeend: createParserOptions returning 0 fails
+Pass Element.beforeend: createParserOptions returning 123 fails
+Pass Element.beforeend: createParserOptions returning "foo" fails
+Pass Element.beforeend: createParserOptions returning true fails
+Pass Element.beforeend: createParserOptions returning false fails
+Pass Element.beforebegin: createParserOptions can inject a sanitizer config
+Pass Element.beforebegin: createParserOptions receives correct type and sink name
+Pass Element.beforebegin: createParserOptions can inject a sanitizer
+Pass Element.beforebegin: createParserOptions returning null fails
+Pass Element.beforebegin: createParserOptions returning undefined fails
+Pass Element.beforebegin: createParserOptions returning 0 fails
+Pass Element.beforebegin: createParserOptions returning 123 fails
+Pass Element.beforebegin: createParserOptions returning "foo" fails
+Pass Element.beforebegin: createParserOptions returning true fails
+Pass Element.beforebegin: createParserOptions returning false fails
+Pass Element.afterend: createParserOptions can inject a sanitizer config
+Pass Element.afterend: createParserOptions receives correct type and sink name
+Pass Element.afterend: createParserOptions can inject a sanitizer
+Pass Element.afterend: createParserOptions returning null fails
+Pass Element.afterend: createParserOptions returning undefined fails
+Pass Element.afterend: createParserOptions returning 0 fails
+Pass Element.afterend: createParserOptions returning 123 fails
+Pass Element.afterend: createParserOptions returning "foo" fails
+Pass Element.afterend: createParserOptions returning true fails
+Pass Element.afterend: createParserOptions returning false fails
+Pass Element.parseHTMLUnsafe: createParserOptions can inject a sanitizer config
+Pass Element.parseHTMLUnsafe: createParserOptions receives correct type and sink name
+Pass Element.parseHTMLUnsafe: createParserOptions can inject a sanitizer
+Pass Element.parseHTMLUnsafe: createParserOptions can override a sanitizer config
Pass Element.parseHTMLUnsafe: createParserOptions can remove a sanitizer
-Fail Element.parseHTMLUnsafe: createParserOptions returning null fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning undefined fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning 0 fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning 123 fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning "foo" fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning true fails
-Fail Element.parseHTMLUnsafe: createParserOptions returning false fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning null fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning undefined fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning 0 fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning 123 fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning "foo" fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning true fails
+Pass Element.parseHTMLUnsafe: createParserOptions returning false fails
Pass Element.setHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.setHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.setHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.appendHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.appendHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.appendHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.prependHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.prependHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.prependHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.beforeHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.beforeHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.beforeHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.afterHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.afterHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.afterHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can override runScripts from true to false
-Fail Element.replaceWithHTMLUnsafe: createParserOptions can override runScripts from false to true
-Fail Element.replaceWithHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
-Fail Element.innerHTML: createParserOptions returning {runScripts: true} enables script execution
-Fail Element.outerHTML: createParserOptions returning {runScripts: true} enables script execution
-Fail Element.afterbegin: createParserOptions returning {runScripts: true} enables script execution
-Fail Element.beforeend: createParserOptions returning {runScripts: true} enables script execution
-Fail Element.beforebegin: createParserOptions returning {runScripts: true} enables script execution
-Fail Element.afterend: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.setHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.setHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.appendHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass Element.appendHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.appendHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.prependHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass Element.prependHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.prependHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.beforeHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass Element.beforeHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.beforeHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.afterHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass Element.afterHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.afterHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can override runScripts from true to false
+Pass Element.replaceWithHTMLUnsafe: createParserOptions can override runScripts from false to true
+Pass Element.replaceWithHTMLUnsafe: createParserOptions with sanitizer prevents createHTML from running
+Pass Element.innerHTML: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.outerHTML: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.afterbegin: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.beforeend: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.beforebegin: createParserOptions returning {runScripts: true} enables script execution
+Pass Element.afterend: createParserOptions returning {runScripts: true} enables script execution
Pass Element: createContextualFragment with createParserOptions(runScripts=false) does not run scripts
-Fail Element: createContextualFragment runs scripts by default
-Fail Element.setHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.appendHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.prependHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.beforeHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.afterHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.replaceWithHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.innerHTML: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.outerHTML: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.createContextualFragment: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.afterbegin: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.beforeend: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.beforebegin: exception in createParserOptions is rethrown and prevents createHTML
-Fail Element.afterend: exception in createParserOptions is rethrown and prevents createHTML
\ No newline at end of file
+Pass Element: createContextualFragment runs scripts by default
+Pass Element.setHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.appendHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.prependHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.beforeHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.afterHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.replaceWithHTMLUnsafe: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.innerHTML: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.outerHTML: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.createContextualFragment: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.afterbegin: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.beforeend: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.beforebegin: exception in createParserOptions is rethrown and prevents createHTML
+Pass Element.afterend: exception in createParserOptions is rethrown and prevents createHTML
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document-sanitizer.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document-sanitizer.txt
index 369744c0983..3d488d789c3 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document-sanitizer.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document-sanitizer.txt
@@ -2,26 +2,25 @@ Harness status: OK
Found 26 tests
-14 Pass
-12 Fail
+26 Pass
Pass innerHTML on XML document throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
Pass outerHTML on XML document throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
Pass insertAdjacentHTML on XML document throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
Pass createContextualFragment on XML document throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
Pass innerHTML on XML document created by DOMParser throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
Pass innerHTML on XML document from XHR response throws TypeError without calling createParserOptions if default policy provides only a sanitizer without createHTML
-Fail setHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail setHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
-Fail appendHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail appendHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
-Fail prependHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail prependHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
-Fail beforeHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail beforeHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
-Fail afterHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail afterHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
-Fail replaceWithHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
-Fail replaceWithHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass setHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass setHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass appendHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass appendHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass prependHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass prependHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass beforeHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass beforeHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass afterHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass afterHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
+Pass replaceWithHTMLUnsafe on XML document does not throw TypeError and applies createParserOptions sanitizer
+Pass replaceWithHTMLUnsafe on XML document does not throw TypeError when createParserOptions has no sanitizer
Pass innerHTML on XML document executes createHTML and does not call createParserOptions when default policy provides both
Pass outerHTML on XML document executes createHTML and does not call createParserOptions when default policy provides both
Pass insertAdjacentHTML on XML document executes createHTML and does not call createParserOptions when default policy provides both
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document.txt
index 25b4640635f..36495ece1a6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtml-xml-document.txt
@@ -2,12 +2,13 @@ Harness status: OK
Found 8 tests
-8 Fail
-Fail Testcase #0 with xmlDoc.setHTML("Hello!")
+4 Pass
+4 Fail
+Pass Testcase #0 with xmlDoc.setHTML("Hello!")
Fail Testcase #0, shadow inside xmlDoc, shadowroot.setHTML("Hello!")
-Fail Testcase #1 with xmlDoc.setHTML("<br>")
+Pass Testcase #1 with xmlDoc.setHTML("<br>")
Fail Testcase #1, shadow inside xmlDoc, shadowroot.setHTML("<br>")
-Fail Testcase #2 with xmlDoc.setHTML("<p>Hi</p>")
+Pass Testcase #2 with xmlDoc.setHTML("<p>Hi</p>")
Fail Testcase #2, shadow inside xmlDoc, shadowroot.setHTML("<p>Hi</p>")
-Fail Testcase #3 with xmlDoc.setHTML("<iframe></iframe><p>text</p>")
+Pass Testcase #3 with xmlDoc.setHTML("<iframe></iframe><p>text</p>")
Fail Testcase #3, shadow inside xmlDoc, shadowroot.setHTML("<iframe></iframe><p>text</p>")
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.txt
index 26501bf0243..79281b5f352 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/sethtmlunsafe-toplevel-template-script.txt
@@ -1,9 +1,16 @@
Harness status: OK
-Found 3 tests
+Found 10 tests
-1 Pass
-2 Fail
-Fail Top-level template and script testcases from sub.dat
+9 Pass
+1 Fail
+Pass Top-level template and script testcases from sub.dat
Pass Top-level <script> parsed through setHTMLUnsafe() without runScripts does not execute
-Fail Top-level <script> parsed through setHTMLUnsafe() with runScripts: true executes
\ No newline at end of file
+Pass Top-level <script> parsed through setHTMLUnsafe() with runScripts: true executes
+Pass Testcase #0 [setHTMLUnsafe], "<template><b>Hello</b></template>", config: "{}"
+Fail Testcase #1 [setHTMLUnsafe], "<template shadowrootmode="open"><span>Inside</span></template>", config: "{}"
+Pass Testcase #2 [setHTMLUnsafe], "<template><b>Hello</b></template>", config: "{ "replaceWithChildrenElements": ["template"] }"
+Pass Testcase #3 [setHTMLUnsafe], "<template><b>Hello</b></template>", config: "{ "removeElements": ["template"] }"
+Pass Testcase #4 [setHTMLUnsafe], "<script>alert(1);</script>", config: "{}"
+Pass Testcase #5 [setHTMLUnsafe], "<script><b>Hello</b></script>", config: "{ "replaceWithChildrenElements": ["script"] }"
+Pass Testcase #6 [setHTMLUnsafe], "<template><p>Text</p><div>More</div></template>", config: "{}"
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/trustedhtml-unvetted-parser-options-no-enforcement.txt b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/trustedhtml-unvetted-parser-options-no-enforcement.txt
index 1a2c72ba0da..c0bfada1c43 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/trustedhtml-unvetted-parser-options-no-enforcement.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/sanitizer-api/trustedhtml-unvetted-parser-options-no-enforcement.txt
@@ -2,33 +2,33 @@ Harness status: OK
Found 29 tests
-29 Fail
-Fail Element.setHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Element.setHTMLUnsafe: string with a sanitizer config is allowed
-Fail Element.setHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Element.appendHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Element.appendHTMLUnsafe: string with a sanitizer config is allowed
-Fail Element.appendHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Element.prependHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Element.prependHTMLUnsafe: string with a sanitizer config is allowed
-Fail Element.prependHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail ShadowRoot.setHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail ShadowRoot.setHTMLUnsafe: string with a sanitizer config is allowed
-Fail ShadowRoot.setHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail ShadowRoot.appendHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail ShadowRoot.appendHTMLUnsafe: string with a sanitizer config is allowed
-Fail ShadowRoot.appendHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail ShadowRoot.prependHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail ShadowRoot.prependHTMLUnsafe: string with a sanitizer config is allowed
-Fail ShadowRoot.prependHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Node.beforeHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Node.beforeHTMLUnsafe: string with a sanitizer config is allowed
-Fail Node.beforeHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Node.afterHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Node.afterHTMLUnsafe: string with a sanitizer config is allowed
-Fail Node.afterHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Node.replaceWithHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Node.replaceWithHTMLUnsafe: string with a sanitizer config is allowed
-Fail Node.replaceWithHTMLUnsafe: TrustedHTML with runScripts true is allowed
-Fail Document.parseHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
-Fail Document.parseHTMLUnsafe: string with a sanitizer config is allowed
\ No newline at end of file
+29 Pass
+Pass Element.setHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Element.setHTMLUnsafe: string with a sanitizer config is allowed
+Pass Element.setHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Element.appendHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Element.appendHTMLUnsafe: string with a sanitizer config is allowed
+Pass Element.appendHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Element.prependHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Element.prependHTMLUnsafe: string with a sanitizer config is allowed
+Pass Element.prependHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass ShadowRoot.setHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass ShadowRoot.setHTMLUnsafe: string with a sanitizer config is allowed
+Pass ShadowRoot.setHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass ShadowRoot.appendHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass ShadowRoot.appendHTMLUnsafe: string with a sanitizer config is allowed
+Pass ShadowRoot.appendHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass ShadowRoot.prependHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass ShadowRoot.prependHTMLUnsafe: string with a sanitizer config is allowed
+Pass ShadowRoot.prependHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Node.beforeHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Node.beforeHTMLUnsafe: string with a sanitizer config is allowed
+Pass Node.beforeHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Node.afterHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Node.afterHTMLUnsafe: string with a sanitizer config is allowed
+Pass Node.afterHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Node.replaceWithHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Node.replaceWithHTMLUnsafe: string with a sanitizer config is allowed
+Pass Node.replaceWithHTMLUnsafe: TrustedHTML with runScripts true is allowed
+Pass Document.parseHTMLUnsafe: TrustedHTML with a sanitizer config is allowed
+Pass Document.parseHTMLUnsafe: string with a sanitizer config is allowed
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/trusted-types/script-enforcement-001.txt b/Tests/LibWeb/Text/expected/wpt-import/trusted-types/script-enforcement-001.txt
index 4293daa587a..d8b155541cf 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/trusted-types/script-enforcement-001.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/trusted-types/script-enforcement-001.txt
@@ -1,8 +1,8 @@
Harness status: OK
-Found 34 tests
+Found 35 tests
-34 Pass
+35 Pass
Pass The HTMLScriptElement is initially trusted.
Pass Script source set via TrustedScript sink HTMLScriptElement.innerText keeps trustworthiness.
Pass Script source set via HTMLElement.innerText drops trustworthiness.
@@ -11,6 +11,7 @@ Pass Script source set Node.textContent drops trustworthiness.
Pass Script source set via TrustedScript sink HTMLScriptElement.text keeps trustworthiness.
Pass Script source set via TrustedHTML sink Element.innerHTML drops trustworthiness.
Pass Script source set via TrustedHTML sink Element.setHTMLUnsafe() drops trustworthiness.
+Pass Script source cannot be set via Element.setHTML().
Pass Splitting script source via Text.splitText() keeps trustworthiness.
Pass Normalizing script source via Element.normalize() keeps trustworthiness.
Pass Script source set via Node.nodeValue drops trustworthiness.
@@ -36,4 +37,4 @@ Pass Setting script source via Node.insertAdjacentText() drops trustworthiness.
Pass Setting script source via Range.insertNode() drops trustworthiness.
Pass Setting script source via Range.deleteContents() drops trustworthiness.
Pass Cloning a script via Node.cloneNode() drops trustworthiness.
-Pass Cloning a script via Range.cloneContents() drops trustworthiness.
+Pass Cloning a script via Range.cloneContents() drops trustworthiness.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/HTML/Sanitizer-svg-event-handler-attributes.html b/Tests/LibWeb/Text/input/HTML/Sanitizer-svg-event-handler-attributes.html
new file mode 100644
index 00000000000..58befb6f873
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/Sanitizer-svg-event-handler-attributes.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ const namespace = "http://www.w3.org/2000/svg";
+ const attributes = ["dur", "onbegin", "onend", "onrepeat"];
+ const markup = '<svg><animate dur="1s" onbegin="void 0" onend="void 0" onrepeat="void 0"></animate></svg>';
+ const configurations = [
+ ["permissive", () => ({})],
+ ["attribute allowlist", () => ({ attributes })],
+ [
+ "element attribute allowlist",
+ () => ({
+ elements: [
+ "html",
+ "head",
+ "body",
+ { name: "svg", namespace },
+ { name: "animate", namespace, attributes },
+ ],
+ attributes: [],
+ }),
+ ],
+ ];
+
+ function printAttributes(label, root) {
+ const animation = root.querySelector("animate");
+ println(`${label}: ${animation.localName} ${animation.getAttributeNames().sort().join(",")}`);
+ }
+
+ for (const [name, configuration] of configurations) {
+ const container = document.createElement("div");
+ container.setHTMLUnsafe(markup, { sanitizer: configuration() });
+ printAttributes(`${name}, unsafe`, container);
+
+ container.setHTML(markup, { sanitizer: configuration() });
+ printAttributes(`${name}, safe`, container);
+
+ const parsed = Document.parseHTML(markup, { sanitizer: configuration() });
+ printAttributes(`${name}, parseHTML`, parsed);
+
+ const sanitizer = new Sanitizer(configuration());
+ sanitizer.removeUnsafe();
+ container.setHTMLUnsafe(markup, { sanitizer });
+ printAttributes(`${name}, removeUnsafe`, container);
+ }
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/sanitizer-api/sanitizer-inert-document.html b/Tests/LibWeb/Text/input/wpt-import/sanitizer-api/sanitizer-inert-document.html
new file mode 100644
index 00000000000..a951c7510a1
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/sanitizer-api/sanitizer-inert-document.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Test whether fragment created for sanitization is inert.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="test"></div>
+<script>
+promise_test(t => {
+ return new Promise((resolve, fail) => {
+ globalThis.failsafe = fail;
+ globalThis.resolvesafe = resolve;
+
+ const div = document.createElement("div");
+ document.getElementById("test").appendChild(div);
+ div.setHTML(`<img src="data:image/png," onerror="globalThis.failsafe('shouldnt load')">`);
+
+ const div2 = document.createElement("div");
+ document.getElementById("test").appendChild(div2);
+ div2.innerHTML = `<img src="data:image/png," onerror="globalThis.resolvesafe('shoud load')">`;
+ });
+}, "Test whether setHTML executes the fail handler.");
+
+promise_test(t => {
+ return new Promise((resolve, fail) => {
+ globalThis.failunsafe = fail;
+ globalThis.resolveunsafe = resolve;
+
+ const div = document.createElement("div");
+ document.getElementById("test").appendChild(div);
+ div.setHTMLUnsafe(
+ `<img src="data:image/png," onerror="globalThis.failunsafe()">`,
+ {sanitizer: {removeElements: ["img"]}});
+
+ const div2 = document.createElement("div");
+ document.getElementById("test").appendChild(div2);
+ div2.innerHTML = `<img src="data:image/png," onerror="globalThis.resolveunsafe()">`;
+ });
+}, "Test whether setHTMLUnsafe executes the fail handler.");
+
+const url = "/fetch/metadata/resources/record-header.py?file=image";
+const options = {sanitizer: {removeElements: ["img"]}};
+
+promise_test(t => {
+ return new Promise((resolve, fail) => {
+ const div = document.createElement("div");
+ document.getElementById("test").appendChild(div);
+ div.setHTML(`<img src="${url}">`, options);
+ fetch(url + "&retrieve=true")
+ .then(response => response.text())
+ .then(text => {
+ if (text.includes("No header has been recorded"))
+ resolve()
+ else
+ fail("The server observed a request. It shouldn't have.");
+ });
+ });
+}, "Test whether setHTML loads the image.");
+
+promise_test(t => {
+ return new Promise((resolve, fail) => {
+ const div = document.createElement("div");
+ document.getElementById("test").appendChild(div);
+ div.setHTMLUnsafe(`<img src="${url}">`, options);
+ fetch(url + "&retrieve=true")
+ .then(response => response.text())
+ .then(text => {
+ if (text.includes("No header has been recorded"))
+ resolve()
+ else
+ fail("The server observed a request. It shouldn't have.");
+ });
+ });
+}, "Test whether setHTMLUnsafe loads the image.");
+</script>
+</body>
+</html>