From f1d7f3bb694102dea642ca1ddd9887cb9a1e585f Mon Sep 17 00:00:00 2001
From: Noam Rosenthal Let target be this's template contents if
this is a Set and filter HTML given target, html,
- options, and true. Let fragment be the result of invoking the fragment parsing algorithm
+ steps given target, html, options, and " If fragment is non-null, then replace
+ all with fragment within target.dataTrustedScriptURLtemplate element; otherwise this.remove".
Set and filter HTML given this, html, - options, and true.
Let fragment be the result of invoking the fragment parsing algorithm
+ steps given this, html, options, and "remove".
If fragment is non-null, then replace + all with fragment within this.
Let compliantHTML be the result of invoking the get trusted type compliant string algorithm with Let (compliantHTML, compliantOptions) be the result of invoking the
+ get trusted type compliant input algorithm with TrustedHTML, this's relevant global
- object, html, "Element setHTMLUnsafe", and "script".
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 fragment be the result of invoking the fragment parsing algorithm
+ steps given target, compliantHTML, compliantOptions, and
+ "keep".
If fragment is non-null, then replace + all with fragment within target.
Let compliantHTML be the result of invoking the get trusted type compliant string algorithm with Let (compliantHTML, compliantOptions) be the result of invoking the
+ get trusted type compliant input algorithm with TrustedHTML, this's relevant global
- object, html, "ShadowRoot setHTMLUnsafe", and "script".
ShadowRoot
+ setHTMLUnsafe".
+
+ Let fragment be the result of invoking the fragment parsing algorithm
+ steps given this, compliantHTML, compliantOptions, and
+ "keep".
Set and filter HTML given this, compliantHTML, - options, and false.
If fragment is non-null, then replace + all with fragment within this.
Let compliantHTML be the result of invoking the get trusted type compliant string algorithm with Let (compliantHTML, compliantOptions) be the result of invoking the
+ get trusted type compliant input algorithm with TrustedHTML, this's relevant global
- object, html, "Document parseHTMLUnsafe", and "script".
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.
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
+ options, and unsafeMarkupHandling, which is one of "remove", "keep", or "legacy",
+ are:
Assert: scriptingMode is either Inert or Fragment. +
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:
+remove";script"; andthen return null.
+Let safe be true if unsafeMarkupHandling is "remove"; otherwise false.
Let sanitizer be the result of calling getting a sanitizer from options given safe.
If target's node document is an XML
+ Let scriptingMode be Inert. If options[" Assert: unsafeMarkupHandling is not " Set scriptingMode to Fragment. Let allowDeclarativeShadowRoots be false if unsafeMarkupHandling is
+ " If unsafeMarkupHandling is " Return the result of the HTML fragment parsing algorithm given
- target, markup, false, and scriptingMode. Let fragment be the result of the HTML fragment parsing algorithm
+ given target, markup, allowDeclarativeShadowRoots, and
+ scriptingMode. Sanitize fragment given sanitizer and
+ safe. Return fragment.runScripts"]
+ is true:
+
+ remove".legacy"; otherwise true.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.
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.
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 (compliantString, compliantOptions) be the result of invoking
+ the get trusted type compliant input algorithm with
+ TrustedHTML, this's relevant global
+ object, the given value, a new SetHTMLUnsafeOptions dictionary, and "Element innerHTML".
Let fragment be the result of invoking the fragment parsing algorithm - steps with target and compliantString.
Let fragment be the result of invoking the fragment parsing algorithm
+ steps given this, compliantString, compliantOptions,
+ and "legacy".
Replace all with fragment - within target.
Replace all with fragment within + this.
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
+ TrustedHTML, this's relevant global
+ object, the given value, a new SetHTMLUnsafeOptions dictionary, and "ShadowRoot innerHTML".
Let fragment be the result of invoking the fragment parsing algorithm - steps with this and compliantString.
legacy".
Replace all with fragment within this.
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
+ TrustedHTML, this's relevant global
+ object, the given 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
+ TrustedHTML, this's relevant global
+ object, the given value, 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
+ TrustedHTML, 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:
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.
If options["runScripts"]
- is true:
Assert: safe is false.
Set scriptingMode to Fragment.
-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
From e9aa4f11d6a9e8b554fb49a846d916587ed905b5 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal Let target be this's template contents if
this is a Let fragment be the result of invoking the fragment parsing algorithm
- steps given target, html, options, and " If fragment is non-null, then replace
- all with fragment within target. Set and filter HTML given target,
+ html, and options.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
@@ -125451,7 +125452,7 @@ document.body.appendChild(frame)
partial interface ShadowRoot {
[CEReactions] undefined setHTML(DOMString html, optional SetHTMLOptions options = {});
- [CEReactions] undefined setHTMLUnsafe((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;
@@ -125461,7 +125462,7 @@ document.body.appendChild(frame)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;
From 9270dec4199e717229b657fe27f383201a0918bd Mon Sep 17 00:00:00 2001
From: Noam Rosenthal template element; otherwise this.remove".
Let fragment be the result of invoking the fragment parsing algorithm
- steps given this, html, options, and "remove".
If fragment is non-null, then replace - all with fragment within this.
Set and filter HTML given this, + html, and options.
Let target be this's template contents if
this is a template element; otherwise this.
Let fragment be the result of invoking the fragment parsing algorithm
- steps given target, compliantHTML, compliantOptions, and
- "keep".
If fragment is non-null, then replace - all with fragment within target.
Set and filter HTML given target, + compliantHTML, compliantOptions, and Unsafe.
ShadowRoot
setHTMLUnsafe".
- Let fragment be the result of invoking the fragment parsing algorithm
- steps given this, compliantHTML, compliantOptions, and
- "keep".
If fragment is non-null, then replace - all with fragment within this.
Set and filter HTML given this, + compliantHTML, compliantOptions, and Unsafe.
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, a dictionary
- options, and unsafeMarkupHandling, which is one of "remove", "keep", or "legacy",
- are:
DocumentFragment target, a string markup, a dictionary or TrustedParserOptions object options, and a
+ fragment parser mode mode, are:
Let context be target if target is an @@ -125993,17 +126013,17 @@ enum DOMParserSupportedType {
If all of the following are true:
remove";script"; andscript"; and then return null.
Let safe be true if unsafeMarkupHandling is "remove"; otherwise false.
Let safe be true if mode is Normal; otherwise false.
Let sanitizer be the result of calling getting a sanitizer from options given safe.
If options["runScripts"]
is true:
Assert: unsafeMarkupHandling is not "remove".
Assert: mode is not Normal.
Set scriptingMode to Fragment.
Let allowDeclarativeShadowRoots be false if unsafeMarkupHandling is
- "legacy"; otherwise true.
Let allowDeclarativeShadowRoots be false if mode is Legacy; otherwise true.
If unsafeMarkupHandling is "legacy" and
+
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.
Element innerHTML".
- Let fragment be the result of invoking the fragment parsing algorithm
- steps given this, compliantString, compliantOptions,
- and "legacy".
Replace all with fragment within - this.
Set and filter HTML given this, + compliantString, compliantOptions, and Legacy.
ShadowRoot innerHTML".
- Let fragment be the result of invoking the fragment parsing algorithm
- steps given this, compliantString, compliantOptions,
- and "legacy".
Replace all with fragment - within this.
Set and filter HTML given this, + compliantString, compliantOptions, and Legacy.
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.
Let fragment be the result of invoking the fragment parsing algorithm
steps given context, compliantString, compliantOptions,
- and "legacy".
Return the result of invoking the fragment parsing algorithm steps given
- element, compliantString, compliantOptions, and "legacy".
TrustedScriptdataTrustedScriptURLTrustedParserOptionsTrustedParserOptionsLet target be this's template contents if
this is a template element; otherwise this.
Set and filter HTML given target, - html, and options.
Set and filter HTML given target, html, and + options.
Set and filter HTML given this, - html, and options.
Set and filter HTML given this, html, and + options.
Let target be this's template contents if
this is a template element; otherwise this.
Set and filter HTML given target,
- compliantHTML, compliantOptions, and Set and filter HTML given target, compliantHTML,
+ compliantOptions, and Unsafe.
Let allowDeclarativeShadowRoots be false if mode is Legacy; otherwise true.
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.
If mode is Legacy and + target's node document is an XML + document, then: + +
Assert: sanitizer is null.
+ +Sanitization is only supported on HTML documents. Trusted types throws when a + policy assigns a sanitizer when applying to XML 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 @@ -126079,14 +126093,17 @@ enum DOMParserSupportedType { are:
Let (compliantString, compliantOptions) be the result of invoking
- the get trusted type compliant input algorithm with
- TrustedHTML, this's relevant global
- object, the given value, a new SetHTMLUnsafeOptions dictionary, and "Element innerHTML".
Let (compliantString, compliantOptions) be the result of invoking
+ the get trusted type compliant input algorithm with
+ TrustedHTML, this's relevant global
+ object, the given value, a new SetHTMLUnsafeOptions dictionary, and "Element innerHTML".
Set and filter HTML given this,
- compliantString, compliantOptions, and Let target be this's template contents if
+ this is a template element; otherwise this.
Set and filter HTML given target, compliantString, + compliantOptions, and Legacy.
To get a sanitizer instance from options from a dictionary options with a - boolean safe:
+To get a sanitizer instance from options from a TrustedParserOptions or dictionary options,
+ given a boolean safe:
Let sanitizerSpec be "default".
If options is a TrustedParserOptions, then set sanitizerSpec
+ to options's sanitizer
+ config.
If options["sanitizer"]
exists, then set sanitizerSpec to
options["sanitizer"].
Assert: sanitizer is null.
+If sanitizer is non-null, then throw a TypeError.
Sanitization is only supported on HTML documents. Trusted types throws when a - policy assigns a sanitizer when applying to XML documents.
+Sanitization is only supported on HTML documents.
Return the result of invoking the XML fragment parsing algorithm given @@ -126089,15 +126088,15 @@ enum DOMParserSupportedType {
Element's innerHTML setter steps
- are:
Element's innerHTML setter steps given
+ value are:
Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
- TrustedHTML, this's relevant global
- object, the given value, a new SetHTMLUnsafeOptions dictionary, and "Element innerHTML".
Element
+ innerHTML".
Let target be this's template contents if
this is a template element; otherwise this.
ShadowRoot's innerHTML setter
- steps are:
ShadowRoot's innerHTML setter steps
+ given value are:
Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
- TrustedHTML, this's relevant global
- object, the given value, a new SetHTMLUnsafeOptions dictionary, and "ShadowRoot innerHTML".
ShadowRoot
+ innerHTML".
Set and filter HTML given this, compliantString, compliantOptions, and DOMParserSupportedType {
Element's outerHTML setter steps
- are:
Element's outerHTML setter steps given
+ value are:
Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
- TrustedHTML, this's relevant global
- object, the given value, a new SetHTMLUnsafeOptions dictionary, and "Element outerHTML".
Element
+ outerHTML".
Let parent be this's parent.
Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
TrustedHTML, this's relevant global
- object, the given value, a new SetHTMLUnsafeOptions dictionary, and ", string, a new SetHTMLUnsafeOptions dictionary, and "Element insertAdjacentHTML".
Let context be null.
Let (compliantHTML, compliantOptions) be the result of invoking the
- get trusted type compliant input algorithm with TrustedHTML, this's relevant global
- object, html, options, and "Element
- setHTMLUnsafe".
Element setHTMLUnsafe".
Let target be this's template contents if
this is a template element; otherwise this.
Let (compliantHTML, compliantOptions) be the result of invoking the
- get trusted type compliant input algorithm with TrustedHTML, this's relevant global
- object, html, options, and "ShadowRoot
- setHTMLUnsafe".
ShadowRoot setHTMLUnsafe".
Set and filter HTML given this,
compliantHTML, compliantOptions, and DOMParserSupportedType {
Let (compliantHTML, compliantOptions) be the result of invoking the
- get trusted type compliant input algorithm with
TrustedHTML, this's relevant global
- object, html, options, and "Document
- parseHTMLUnsafe".Document parseHTMLUnsafe".
Let document be a new Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
- Document, whose DOMParserSupportedType {
TrustedHTML, this's relevant global
- object, string, a new SetHTMLUnsafeOptions dictionary, and "Element insertAdjacentHTML".Element
+ insertAdjacentHTML".
Let context be null.
Let sanitizerSpec be "default".
Let sanitizerSpec be null.
If options is a TrustedParserOptions, then set sanitizerSpec
to options's sanitizer
config.
If options["sanitizer"]
- exists, then set sanitizerSpec to
- options["sanitizer"].
If options is a dictionary and options["sanitizer"] exists,
+ then set sanitizerSpec to options["sanitizer"].
If sanitizerSpec is null:
+ +If safe is true, then set sanitizerSpec to "default".
Otherwise, return null.
Assert: sanitizerSpec is either a Sanitizer instance,
a SanitizerPresets member, or a SanitizerConfig dictionary.
Let sanitizerSpec be null.
Let sanitizerSpec be "default".
If options is a TrustedParserOptions, then set sanitizerSpec
to options's sanitizer
config.
If options is a dictionary and options["sanitizer"] exists,
- then set sanitizerSpec to options["sanitizer"].
If sanitizerSpec is null:
- -If safe is true, then set sanitizerSpec to "default".
Otherwise, return null.
If options["sanitizer"]
+ exists, then set sanitizerSpec to
+ options["sanitizer"].
Assert: sanitizerSpec is either a Sanitizer instance,
a SanitizerPresets member, or a SanitizerConfig dictionary.
Let sanitizerSpec be "default".
If options is a TrustedParserOptions, then set sanitizerSpec
- to options's sanitizer
- config.
If options["sanitizer"]
- exists, then set sanitizerSpec to
- options["sanitizer"].
If options is a TrustedParserOptions, then:
If options's sanitizer config is null, then return + null.
Set sanitizerSpec to options's sanitizer config.
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.
Let (compliantString, compliantOptions) be the result of invoking
the get trusted type compliant input algorithm with
- TrustedHTML, this's relevant global
- object, string, a new SetHTMLUnsafeOptions whose this's relevant global object, string, a new
+ SetHTMLUnsafeOptions whose runScripts is true, and "Range createContextualFragment".
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 sanitizer be the result of calling get a sanitizer instance from options with compliantOptions and false.
Call sanitize on document with sanitizer and - false.
If sanitizer is not null, then sanitize document with + sanitizer and false.
Return document.
Sanitize fragment given sanitizer and - safe.
If sanitizer is not null, then sanitize fragment given + sanitizer and safe.
Return fragment.