diff --git a/source b/source index 90c6259281b..483cdd18bd9 100644 --- a/source +++ b/source @@ -4993,7 +4993,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
TrustedScriptdataTrustedScriptURLTrustedParserOptionsTrustedHTML or DOMString) html, optional ParseHTMLUnsafeOptions options = {});
+ static Document parseHTMLUnsafe((TrustedHTML or DOMString) html, optional (ParseHTMLUnsafeOptions or TrustedParserOptions) options = {});
static Document parseHTML(DOMString html, optional SetHTMLOptions options = {});
// resource metadata management
@@ -125450,7 +125453,7 @@ document.body.appendChild(frame)
partial interface Element {
[CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
- [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional SetHTMLUnsafeOptions options = {});
+ [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedParserOptions) options = {});
DOMString getHTML(optional GetHTMLOptions options = {});
[CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
@@ -125460,7 +125463,7 @@ document.body.appendChild(frame)
partial interface ShadowRoot {
[CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
- [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional SetHTMLUnsafeOptions options = {});
+ [CEReactions] undefined setHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedParserOptions) options = {});
DOMString getHTML(optional GetHTMLOptions options = {});
[CEReactions] attribute (TrustedHTML or [LegacyNullToEmptyString] DOMString) innerHTML;
@@ -125730,8 +125733,8 @@ enum DOMParserSupportedType {
Let target be this's template contents if
this is a template element; otherwise this.
Set and filter HTML given target, html, - options, and true.
Set and filter HTML given target, html, and + options.
Set and filter HTML given this, html, - options, and true.
Set and filter HTML given this, html, and + options.
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".
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".
Let target be this's template contents if
this is a template element; otherwise this.
Set and filter HTML given target, compliantHTML, - options, and false.
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".
Let (compliantHTML, compliantOptions) be the result of invoking the
+ get trusted type compliant input algorithm with
+ this's relevant global object, html, options, an
+ "ShadowRoot setHTMLUnsafe".
Set and filter HTML given this, compliantHTML, - options, and false.
Set and filter HTML given this, + compliantHTML, compliantOptions, and Unsafe.
Let sanitizer be the result of calling get a sanitizer instance from options with options and true.
Call sanitize on document with sanitizer and - true.
If sanitizer is not null, then sanitize document with + sanitizer and true.
Return document.
Let compliantHTML be the result of invoking the get trusted type compliant string algorithm with TrustedHTML, this's relevant global
- object, html, "Document parseHTMLUnsafe", and "script".
Let (compliantHTML, compliantOptions) be the result of invoking the
+ get trusted type compliant input algorithm with
+ this's relevant global object, html, options, and
+ "Document parseHTMLUnsafe".
Let document be a new Document, whose DOMParserSupportedType {
compliantHTML.
Let sanitizer be the result of calling get a sanitizer instance from - options with options and false.
Call sanitize on document with sanitizer and - false.
If sanitizer is not null, then sanitize document with + sanitizer and false.
Return document.
A fragment parser mode is one of the following:
+ +To set and filter HTML, given an Element or
+ DocumentFragment target, a string html, a dictionary or TrustedParserOptions object options, and an
+ optional fragment parser mode mode (default Normal):
Let fragment be the result of invoking the fragment parsing algorithm + steps given target, html, options, and + mode.
If fragment is non-null, then replace + all with fragment within target.
The fragment parsing algorithm steps, given an Element or
- DocumentFragment target, a string markup, and an optional
- parser scripting mode scriptingMode (default Inert), are:
DocumentFragment target, a string markup, a dictionary or TrustedParserOptions object options, and a
+ fragment parser mode mode, are:
Assert: scriptingMode is either Inert or Fragment. +
Let context be target if target is an
+ Element; otherwise target's host.
If target's node document is an XML - document, then return the result of invoking the XML fragment parsing - algorithm given target and markup.
Assert: context is non-null.
Return the result of the HTML fragment parsing algorithm given - target, markup, false, and scriptingMode.
If all of the following are true:
+script"; and then return null.
+Let safe be true if mode is Normal; otherwise false.
Let sanitizer be the result of calling getting a sanitizer from options given safe.
Let scriptingMode be Inert.
If options["runScripts"]
+ is true:
Assert: mode is not Normal.
Set scriptingMode to Fragment.
Let allowDeclarativeShadowRoots be false if mode is Legacy; otherwise true.
If mode is Legacy and + target's node document is an XML + document, then: + +
If sanitizer is non-null, then throw a TypeError.
Sanitization is only supported on HTML documents.
+Return the result of invoking the XML fragment parsing algorithm given + target and markup.
Let fragment be the result of the HTML fragment parsing algorithm + given target, markup, allowDeclarativeShadowRoots, and + scriptingMode.
If sanitizer is not null, then sanitize fragment given + sanitizer and safe.
Return fragment.
Element's innerHTML setter steps
- are:
Element's innerHTML setter steps given
+ value are:
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".
Let target be this.
Let (compliantString, compliantOptions) be the result of invoking
+ the get trusted type compliant input algorithm with
+ this's relevant global object, value, a new
+ SetHTMLUnsafeOptions dictionary, and "Element
+ innerHTML".
If target is a template element, then set target to the
- template element's template contents (a
- DocumentFragment).
Setting innerHTML on a
- template element will replace all the nodes in its template contents
- rather than its children.
Let fragment be the result of invoking the fragment parsing algorithm - steps with target and compliantString.
Let target be this's template contents if
+ this is a template element; otherwise this.
Replace all with fragment - within target.
Set and filter HTML given target, compliantString, + compliantOptions, and Legacy.
ShadowRoot's innerHTML setter
- steps are:
ShadowRoot's innerHTML setter steps
+ given value are:
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".
Let (compliantString, compliantOptions) be the result of invoking
+ the get trusted type compliant input algorithm with
+ this's relevant global object, value, a new
+ SetHTMLUnsafeOptions dictionary, and "ShadowRoot
+ innerHTML".
Let fragment be the result of invoking the fragment parsing algorithm - steps with this and compliantString.
Replace all with fragment - within this.
Set and filter HTML given this, + compliantString, compliantOptions, and Legacy.
Element's outerHTML setter steps
- are:
Element's outerHTML setter steps given
+ value are:
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".
Let (compliantString, compliantOptions) be the result of invoking
+ the get trusted type compliant input algorithm with
+ this's relevant global object, value, a new
+ SetHTMLUnsafeOptions dictionary, and "Element
+ outerHTML".
Let parent be this's parent.
Let parent be this's parent.
If parent is null, return. There would be no way to obtain a - reference to the nodes created even if the remaining steps were run.
If parent is null, return. There would be no way to obtain a reference to the + nodes created even if the remaining steps were run.
If parent is a Document, throw a
- "NoModificationAllowedError" DOMException.
If parent is a Document, throw a
+ "NoModificationAllowedError" DOMException.
If parent is a DocumentFragment, set parent to the
- result of creating an element given this's
- node document, "body", and the HTML
- namespace.
If parent is a DocumentFragment, set parent to the
+ result of creating an element given this's
+ node document, "body", and the HTML
+ namespace.
Let fragment be the result of invoking the fragment parsing algorithm - steps given parent and compliantString.
Let fragment be the result of invoking the fragment parsing algorithm + steps given parent, compliantString, compliantOptions, + and Legacy.
Replace this with - fragment within this's parent.
Replace this with + fragment within this's parent.
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".
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, and "Element
+ insertAdjacentHTML".
Let context be null.
Let fragment be the result of invoking the fragment parsing algorithm - steps with context and compliantString.
-Let fragment be the result of invoking the fragment parsing algorithm + steps given context, compliantString, compliantOptions, + and Legacy.
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".
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 whose runScripts is true, and "Range createContextualFragment".
Let node be this's start node.
Return the result of invoking the fragment parsing algorithm steps with - element, compliantString, and Fragment.
Return the result of invoking the fragment parsing algorithm steps given + element, compliantString, compliantOptions, and Legacy.
To set and filter HTML, given an Element or
- DocumentFragment target, a string html, a
- dictionary options, and a boolean safe:
To get a sanitizer instance from options from a TrustedParserOptions or dictionary options,
+ given a boolean safe:
Let context be target if target is an
- Element; otherwise target's host.
Assert: context is non-null.
If all of the following are true:
- -safe;
context's local name is
- "script"; and
context's namespace is the - HTML namespace or the SVG namespace,
then return.
-Let sanitizer be the result of calling getting a sanitizer from options given safe.
Let scriptingMode be Inert.
Let sanitizerSpec be "default".
If options["runScripts"]
- is true:
If options is a TrustedParserOptions, then:
Assert: safe is false.
If options's sanitizer config is null, then return + null.
Set scriptingMode to Fragment.
+Set sanitizerSpec to options's sanitizer config.
Let fragment be the result of invoking the HTML fragment parsing - algorithm given target, html, true, and - scriptingMode.
- -Scripts in fragment will only execute once inserted into - target.
-Sanitize fragment given sanitizer and - safe.
Replace all with fragment within - target.
To get a sanitizer instance from options from a dictionary options with a - boolean safe:
- -Let sanitizerSpec be "default".
If options["sanitizer"]
- exists, then set sanitizerSpec to
- options["sanitizer"].
Otherwise, if options["sanitizer"] exists,
+ then set sanitizerSpec to options["sanitizer"].
Assert: sanitizerSpec is either a Sanitizer instance,
a SanitizerPresets member, or a SanitizerConfig dictionary.