From b8c02818cb56bc6c4233afbade8d9fa39eae6f02 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 90a398292f0775d9d68993f1e4bcf333916dd1aa 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
@@ -125448,7 +125449,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;
@@ -125458,7 +125459,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 a9a953594521ca0f9f7c0f85d3b18cd275e17d2d 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 @@ -125990,17 +126010,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".