diff --git a/source b/source index f5b92937f43..66c1b6281fb 100644 --- a/source +++ b/source @@ -2119,12 +2119,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
Conformance checkers must check that the input document conforms when parsed without a browsing context (meaning that no scripts are run, and - that the parser's scripting mode is Disabled), and should also check that the input document - conforms when parsed with a browsing context in which - scripts execute, and that the scripts never cause non-conforming states to occur other than - transiently during script execution itself. (This is only a "SHOULD" and not a "MUST" - requirement because it has been proven to be impossible. COMPUTABLE)
+ that the parser's scripting is disabled), and + should also check that the input document conforms when parsed with a browsing context in which scripts execute, and that the + scripts never cause non-conforming states to occur other than transiently during script + execution itself. (This is only a "SHOULD" and not a "MUST" requirement because it has been + proven to be impossible. COMPUTABLE)The term "HTML validator" can be used to refer to a conformance checker that itself conforms to the applicable requirements of this specification.
@@ -2905,6 +2905,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute +The following terms are defined in the Streams Standard: STREAMS
+ +WritableStreamTrustedParserOptionsThe close(returnValue) method steps are:
+ data-x="dom-dialog-close">close(returnValue) method steps are:
If returnValue is not given, then set it to null.
A script element has an intended document, which is either null or a
+ Document, initially null.
A script element has a force
async boolean, initially true. It is set to false by the HTML parser and the
XML parser on script elements they insert, and when the element gets an
@@ -68081,9 +68096,10 @@ document.body.append(script1, script2);
If parser document is non-null and el does not have an async attribute, then set el's force async to true.
If parser document is non-null, parser document has a browsing
+ context, and el does not have an async
+ attribute, then set el's force async to
+ true.
This is done so that if a parser-inserted script element fails to
run when the parser tries to run it, but it is later executed after a script dynamically
@@ -68166,8 +68182,9 @@ document.body.append(script1, script2);
Set el's preparation-time document to its node document.
-If parser document is non-null, and parser document is not equal to - el's preparation-time document, then return.
If el's intended document is non-null and el's + intended document is not equal to el's preparation-time + document, then return.
If scripting is disabled for el, then return.
@@ -69073,8 +69090,8 @@ not-slash = %x0000-002E / %x0030-10FFFFAll these contortions are required because, for historical reasons, the
noscript element is handled differently by the HTML parser based on
- whether scripting mode was Disabled
- when the parser was invoked.
The noscript element must not be used in XML documents.
TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedParserOptions) options = {});
[CEReactions] undefined afterHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedParserOptions) options = {});
[CEReactions] undefined replaceWithHTMLUnsafe((TrustedHTML or DOMString) html, optional (SetHTMLUnsafeOptions or TrustedParserOptions) options = {});
+ [CEReactions] WritableStream streamBeforeHTML(optional SetHTMLOptions options = {});
+ [CEReactions] WritableStream streamBeforeHTMLUnsafe(optional SetHTMLUnsafeOptions options = {});
+ [CEReactions] WritableStream streamAfterHTML(optional SetHTMLOptions options = {});
+ [CEReactions] WritableStream streamAfterHTMLUnsafe(optional SetHTMLUnsafeOptions options = {});
+ [CEReactions] WritableStream streamReplaceWithHTML(optional SetHTMLOptions options = {});
+ [CEReactions] WritableStream streamReplaceWithHTMLUnsafe(optional SetHTMLUnsafeOptions options = {});
};
enum SanitizerPresets { "default" };
@@ -125647,7 +125670,7 @@ enum DOMParserSupportedType {
To parse HTML from a string, given a Document document, a
string html, an optional SanitizerConfig or null
- configuration (default null), and an optional boolean safe (default
+ sanitizerConfig (default null), and an optional boolean safe (default
false):
If configuration is not null, then set parser's parser - sanitizer configuration to configuration and set parser's +
If sanitizerConfig is not null, then set parser's parser + sanitizer configuration to sanitizerConfig and set parser's remove javascript navigation URLs to safe.
Place html into the input stream for parser. The @@ -125899,7 +125922,7 @@ enum DOMParserSupportedType {
Element's prependHTML(html, options)
- method steps are:
+ method steps are:
Let firstChild be the first child of this's @@ -125934,7 +125957,7 @@ enum DOMParserSupportedType {
ChildNode's beforeHTML(html, options)
- method steps are:
+ method steps are:
Let parent be the result of getting the parent for HTML insertion @@ -125950,7 +125973,7 @@ enum DOMParserSupportedType {
ChildNode's afterHTML(html, options)
- method steps are:
+ method steps are:
Let parent be the result of getting the parent for HTML insertion @@ -126146,7 +126169,6 @@ enum DOMParserSupportedType { data-x="fragment-parser-mode-unsafe">Unsafe.
The HTML streaming methods (e.g. streamHTML())
+ allow authors to insert chunks of HTML asynchronously using a WritableStream. As
+ chunks are written to the stream, the HTML parser incrementally processes the input
+ and inserts the resulting DOM nodes into the target element.
Unlike synchronous methods such as setHTML(),
+ streaming methods can parse and execute scripts concurrently with the rest of the document
+ lifecycle, provided the method used allows unsafe content (e.g. streamHTMLUnsafe()) and the runScripts option is set to true. Scripts will
+ execute as soon as their end tag is parsed, like in main document parsing. Because the tree is
+ constructed incrementally, scripts can observe partial markup and DOM elements appended before the
+ stream is closed. Scripts marked with the defer attribute
+ will delay execution until the stream is closed, and will be ignored if it is aborted.
stream = element.streamHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces the children of element with the
+ result. element provides context for the HTML parser. The parsed fragments are sanitized based on the options's "sanitizer" member, and unsafe content is removed.
stream = shadowRoot.streamHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces the children of shadowRoot with the
+ result. shadowRoot's host provides
+ context for the HTML parser. The parsed fragments are sanitized
+ based on the options's "sanitizer"
+ member, and unsafe content is removed.
stream = element.streamAppendHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after the last child of
+ element. element provides context for the HTML parser. The parsed fragments
+ are sanitized based on the options's "sanitizer" member, and unsafe content is removed.
stream = shadowRoot.streamAppendHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after the last child of
+ shadowRoot. shadowRoot's host provides context for the HTML parser. The
+ parsed fragments are sanitized based on the options's
+ "sanitizer" member, and unsafe content is removed.
stream = element.streamPrependHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before the first child of
+ element. element provides context for the HTML parser. The parsed fragments
+ are sanitized based on the options's "sanitizer" member, and unsafe content is removed. While streaming, content is
+ inserted before element's first child, at the time of calling the method.
+ Throws a "HierarchyRequestError" DOMException if that node
+ is no longer a child of element.
stream = shadowRoot.streamPrependHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before the first child of
+ shadowRoot. shadowRoot's host provides context for the HTML parser. The
+ parsed fragments are sanitized based on the options's
+ "sanitizer" member, and unsafe content is removed. While streaming, content is
+ inserted before shadowRoot's first child, at the time of calling the
+ method. Throws a "HierarchyRequestError" DOMException if
+ that node is no longer a child of shadowRoot.
stream = childNode.streamBeforeHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before childNode.
+ childNode's parent provides context for the HTML parser. The parsed fragments are
+ sanitized based on the options's "sanitizer" member, and unsafe content is removed. Throws a
+ "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode, at the
+ time of calling the method. Throws a "HierarchyRequestError"
+ DOMException if that node is no longer a child of its parent.
stream = childNode.streamAfterHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after childNode.
+ childNode's parent provides context for the HTML parser. The parsed fragments are
+ sanitized based on the options's "sanitizer" member, and unsafe content is removed. Throws a
+ "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode's
+ next sibling, at the time of calling the method. Throws a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of childNode's parent.
stream = childNode.streamReplaceWithHTML([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces childNode with the result.
+ childNode's parent provides context for the HTML parser. The parsed fragments are
+ sanitized based on the options's "sanitizer" member, and unsafe content is removed. Throws a
+ "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode's
+ next sibling, at the time of calling the method. Throws a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of childNode's former parent.
stream = element.streamHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces the children of element with the
+ result. element provides context for the HTML parser. If the options
+ dictionary contains a "sanitizer"
+ member, it is used to sanitize the parsed fragments before they are inserted into
+ element. If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is
+ updated.
stream = shadowRoot.streamHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces the children of shadowRoot with the
+ result. shadowRoot's host provides
+ context for the HTML parser. If the options dictionary contains a "sanitizer" member, it is used to
+ sanitize the parsed fragments before they are inserted into shadowRoot.
+ If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is
+ updated.
stream = element.streamAppendHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after the last child of
+ element. element provides context for the HTML parser. If the
+ options dictionary contains a "sanitizer" member, it is used to
+ sanitize the parsed fragments before they are inserted into element. If
+ the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is
+ updated.
stream = shadowRoot.streamAppendHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after the last child of
+ shadowRoot. shadowRoot's host provides context for the HTML parser. If the
+ options dictionary contains a "sanitizer" member, it is used to
+ sanitize the parsed fragments before they are inserted into shadowRoot.
+ If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is
+ updated.
stream = element.streamPrependHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before the first child of
+ element. element provides context for the HTML parser. If the
+ options dictionary contains a "sanitizer" member, it is used to
+ sanitize the parsed fragments before they are inserted into element. If
+ the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is updated.
+ While streaming, content is inserted before element's first child, at the
+ time of calling the method. The stream rejects with a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of element.
stream = shadowRoot.streamPrependHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before the first child of
+ shadowRoot. shadowRoot's host provides context for the HTML parser. If the
+ options dictionary contains a "sanitizer" member, it is used to
+ sanitize the parsed fragments before they are inserted into shadowRoot.
+ If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is updated.
+ While streaming, content is inserted before shadowRoot's first child, at
+ the time of calling the method. The stream rejects with a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of shadowRoot.
stream = childNode.streamBeforeHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result before childNode.
+ childNode's parent provides context for the HTML parser. If the options
+ dictionary contains a "sanitizer"
+ member, it is used to sanitize the parsed fragments before they are inserted into
+ the node tree. If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is updated.
+ Throws a "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode, at the
+ time of calling the method. The stream rejects with a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of its parent.
stream = childNode.streamAfterHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally inserts the result after childNode.
+ childNode's parent provides context for the HTML parser. If the options
+ dictionary contains a "sanitizer"
+ member, it is used to sanitize the parsed fragments before they are inserted into
+ the node tree. If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is updated.
+ Throws a "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode's
+ next sibling, at the time of calling the method. The stream rejects with a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of childNode's parent.
stream = childNode.streamReplaceWithHTMLUnsafe([options])Returns a WritableStream that, as strings are written to it, parses them
+ using the HTML parser, and incrementally replaces childNode with the result.
+ childNode's parent provides context for the HTML parser. If the options
+ dictionary contains a "sanitizer"
+ member, it is used to sanitize the parsed fragments before they are inserted into
+ the node tree. If the options dictionary's "runScripts" member is true, scripts contained
+ in the stream will be executed immediately after they are parsed and the node tree is updated.
+ Throws a "HierarchyRequestError" DOMException if
+ childNode's parent is neither a DocumentFragment nor an
+ Element. While streaming, content is inserted before childNode's
+ next sibling, at the time of calling the method. The stream rejects with a
+ "HierarchyRequestError" DOMException if that node is no
+ longer a child of childNode's former parent.
Element's streamHTML(options) method steps are:
Let target be the HTML insertion target given + this.
Let stream be the result of running stream HTML given + target, null, and options.
Replace all with null within + target.
Return stream.
Element's streamAppendHTML(options) method
+ steps are:
Let target be the HTML insertion target given + this.
Return the result of running stream HTML given target, null, and + options.
Element's streamPrependHTML(options) method
+ steps are:
Let target be the HTML insertion target given + this.
Return the result of running stream HTML given target, + target's first child, and options.
Element's streamHTMLUnsafe(options) method
+ steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Element streamHTMLUnsafe", and true.
Let target be the HTML insertion target given + this.
Let stream be the result of running stream HTML given
+ target, null, compliantOptions, and Unsafe.
Replace all with null within + target. + +
Return stream.
Element's streamAppendHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Element streamAppendHTMLUnsafe", and true.
Let target be the HTML insertion target given + this.
Return the result of running stream HTML given target, null,
+ compliantOptions, and Unsafe.
Element's streamPrependHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Element streamPrependHTMLUnsafe", and true.
Let target be the HTML insertion target given + this.
Let refChild be target's first child.
Return the result of running stream HTML given target,
+ refChild, compliantOptions, and Unsafe.
ShadowRoot's streamHTML(options) method steps
+ are:
Let stream be the result of running stream HTML given + this, null, and options.
Replace all with null within + this.
Return stream.
ShadowRoot's streamAppendHTML(options) method
+ steps are to return the result of running stream HTML given this, null,
+ and options.
ShadowRoot's streamPrependHTML(options)
+ method steps are to return the result of running stream HTML given this,
+ this's first child, and options.
ShadowRoot's streamHTMLUnsafe(options) method
+ steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "ShadowRoot streamHTMLUnsafe", and true.
Let stream be the result of running stream HTML given
+ this, null, compliantOptions, and Unsafe.
Replace all with null within + this.
Return stream.
ShadowRoot's streamAppendHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "ShadowRoot streamAppendHTMLUnsafe", and true.
Return the result of running stream HTML given this, null,
+ compliantOptions, and Unsafe.
ShadowRoot's streamPrependHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "ShadowRoot streamPrependHTMLUnsafe", and true.
Return the result of running stream HTML given this,
+ this's first child, compliantOptions, and Unsafe.
ChildNode's streamBeforeHTML(options) method
+ steps are to return the result of running stream HTML given this's
+ parent for HTML streaming, this, and options.
ChildNode's streamAfterHTML(options) method
+ steps are to return the result of running stream HTML given this's
+ parent for HTML streaming, this's next sibling, and
+ options.
ChildNode's streamReplaceWithHTML(options)
+ method steps are:
Let stream be the result of running stream HTML given + this's parent for HTML streaming, this's next + sibling, and options.
Remove this.
Return stream.
ChildNode's streamBeforeHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Node streamBeforeHTMLUnsafe", and true.
Return the result of running stream HTML given this's
+ parent for HTML streaming, this, compliantOptions, and Unsafe.
ChildNode's streamAfterHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Node streamAfterHTMLUnsafe", and true.
Return the result of running stream HTML given this's
+ parent for HTML streaming, this's next sibling,
+ compliantOptions, and Unsafe.
ChildNode's streamReplaceWithHTMLUnsafe(options)
+ method steps are:
Let compliantOptions be the result of invoking the get trusted type compliant parser options algorithm
+ with this's relevant global object, options, "Node streamReplaceWithHTMLUnsafe", and true.
Let refChild be this's next sibling.
Let stream be the result of running stream HTML given
+ this's parent for HTML streaming, refChild,
+ compliantOptions, and Unsafe.
Remove this.
Return stream.
To get the parent for HTML streaming, given a Node node:
Let parent be node's parent for HTML + insertion.
If parent is null, then throw a
+ "HierarchyRequestError" DOMException.
Return parent.
To stream HTML into an Element or DocumentFragment
+ target, given a Node or null referenceChild, a dictionary or
+ TrustedParserOptionsoptions, and a
+ mode, which is either Normal or Unsafe
+ (default Normal):
Let safe be true if mode is Normal; otherwise
+ false.
Let sanitizerConfig be the result of calling get a sanitizer config from + options with options and safe.
Let contextElement be the result of determining the parser context element given target.
Assert: contextElement is non-null.
If all of the following are true:
+script"; andthen throw a "NotSupportedError" DOMException.
Let runScripts be true if safe is false and
+ options["runScripts"] is
+ true; otherwise false.
Let document be a Document node whose type is "html".
Let parser be the result of initializing an HTML fragment parser with document, target, + target, referenceChild, runScripts, false, + sanitizerConfig, and safe.
Let stream be a new WritableStream in target's relevant realm.
Let writeAlgorithm be the following steps given chunk:
+ +If chunk is a Symbol, then return a promise
+ rejected with a TypeError.
Let chunkString be the result of converting chunk to a DOMString.
If referenceChild is non-null and referenceChild's
+ parent is not target, then abort
+ parser and return a promise rejected with a
+ "HierarchyRequestError" DOMException.
Place chunkString into the input stream for parser. + The encoding confidence is + irrelevant.
Have parser run until it has consumed all the characters just inserted into + the input stream.
Return a promise resolved with undefined.
Let closeAlgorithm be the following steps:
+If referenceChild is non-null and referenceChild's
+ parent is not target, then abort
+ parser and return a promise rejected with a
+ "HierarchyRequestError" DOMException.
Insert an end-of-file token into parser's tokenizer input stream.
Have parser run until it has consumed the end-of-file token.
Return a promise resolved with undefined.
Let abortAlgorithm be the following steps given reason:
+ +Abort parser.
Return a promise resolved with undefined.
Set up stream with + writeAlgorithm, closeAlgorithm, and abortAlgorithm.
Return stream.
Let sanitizerConfig be the result of calling getting a sanitizer from options give + config from options">getting a sanitizer config from options given safe.
Let scriptingMode be Inert.
If options["runScripts"]
- is true:
Assert: mode is not Normal.
Set scriptingMode to Fragment.
Let runScripts be true if safe is false and
+ options["runScripts"] is
+ true; otherwise false.
Let allowDeclarativeShadowRoots be false if mode is Legacy; otherwise true.
If sanitizer is non-null, then throw a TypeError.
If sanitizerConfig is non-null, then throw a TypeError.
Sanitization is only supported on HTML documents.
Return the result of invoking the HTML fragment parsing algorithm given target, markup, allowDeclarativeShadowRoots, - scriptingMode, sanitizerConfig, and safe.
To sanitize an Element element given a
- SanitizerConfig configuration and a boolean
- removeJavascriptNavigationUrls:
To check the sanitizer action for element name given a + SanitizerElementNamespace elementName and a SanitizerConfig + configuration:
Let elementName be a SanitizerElementNamespace with - element's local name and namespace.
If configuration["replaceWithChildrenElements"]
- exists and configuration["replaceWithChildrenElements"]
- contains elementName, then return "Replace with children".
If configuration["replaceWithChildrenElements"]
+ exists and configuration["replaceWithChildrenElements"]
+ contains elementName, then return "Replace with children".
If configuration["elements"]
@@ -128340,11 +128997,29 @@ dictionary SanitizerConfig {
Otherwise, if configuration["removeElements"] contains elementName, return "Remove".
Otherwise, if configuration["removeElements"] contains elementName, return "Remove".
Return "Keep".
To sanitize an Element element given a
+ SanitizerConfig configuration and a boolean
+ removeJavascriptNavigationUrls:
Let elementName be a SanitizerElementNamespace with + element's local name and namespace.
Let action be the sanitizer action for element name given + elementName and configuration.
If action is not "Keep", then return
+ action.
For each attribute of element's @@ -130983,7 +131658,7 @@ interface Navigator {
The unregisterProtocolHandler(scheme,
- url) method steps are:
+ url) method steps are:
Let (normalizedScheme, normalizedURLString) be the result of running @@ -141928,32 +142603,9 @@ dictionary StorageEventInit : EventInit {
A boolean allow declarative shadow roots (initially false).
-The scripting mode, which is a parser scripting mode.
- -A parser scripting mode is one of the following:
- -async
- and defer attributes and blocking the parser when
- encountering a classic script.noscript element can represent fallback
- content.A boolean parser scripting disabled, initially false.
-async and defer
- attributes. This mode is used by createContextualFragment().A Document-or-null script target document, initially null.
The frameset-ok flag is set to "ok" when the parser is created. It is set to "not ok" after certain tokens are seen.
@@ -144880,6 +145532,27 @@ dictionary StorageEventInit : EventInit {Let localName be token's tag name.
Let sanitizerConfig be the parser's parser sanitizer + configuration.
If document is fully active and sanitizerConfig is not + null:
+ +Let elementName be a SanitizerElementNamespace with + localName and namespace.
If the sanitizer action for element name given elementName and
+ config is not "Keep", then set document to
+ document's appropriate template contents owner document.
This ensures that elements removed by the sanitizer are still on the stack + of open elements when streaming, but do not invoke side effects such as loading + images.
+Let is be the value of the "is" attribute in
token, if such an attribute exists; otherwise null.
Follow the generic RCDATA element parsing algorithm.
-Follow the generic raw text element parsing algorithm.
Insert an HTML element for the token.
@@ -145853,16 +146524,12 @@ document.body.appendChild(text); the intended parent being the element in which the adjustedInsertionLocation finds itself.If the scripting mode is not Fragment, then set the element's
- parser document to the Document.
The Fragment
- scripting mode treats parser-inserted scripts as if they were not
- parser-inserted, allowing, for example, executing scripts when applying a fragment created by
- createContextualFragment().
Set the element's parser document to the Document.
If the parser's script target document is non-null, then
+ set the element's intended document to the parser's
+ script target document; otherwise set it to the
+ Document.
Set the element's force async to false.
@@ -145873,10 +146540,6 @@ document.body.appendChild(text); the script from executing until the end tag is seen.If the parser's scripting mode is Inert, then set the script element's
- already started to true. (fragment case)
If the parser was invoked via the document.write() or document.writeln() methods, then optionally set the
@@ -147142,8 +147805,7 @@ document.body.appendChild(text);
Follow the generic raw text element parsing algorithm.
Parse error. Ignore the token.
@@ -147319,8 +147981,8 @@ document.body.appendChild(text);Insert an HTML element for the token.
This element will be an ordinary element. With one exception: if
- scripting mode is Disabled, it can
- also be a noscript element.
noscript element.
The HTML fragment parsing algorithm, given an Element or
- DocumentFragment target, a string input, an
- optional boolean allowDeclarativeShadowRoots (default false), an optional
- parser scripting mode scriptingMode (default Inert), an optional SanitizerConfig or null
- configuration (default null), and an optional boolean safe (default false),
- is the following steps. They return a DocumentFragment.
Parts marked fragment case in algorithms in the HTML - parser section are parts that only occur if the parser was created for the purposes of this - algorithm. The algorithms have been annotated with such markings for informational purposes only; - such markings have no normative weight. If it is possible for a condition described as a - fragment case to occur even when the parser wasn't created for the purposes of - handling this algorithm, then that is an error in the specification.
+To determine the parser context element given a Node target:
Assert: scriptingMode is either Inert or Fragment. +
Return the result of the first matching statement:
-Let context be
- target if target is an Element; otherwise
- target's host.
ElementAssert: context is - non-null.
ShadowRootLet document be a Document node whose type is "html".
DocumentFragment whose host is a template elementLet contextDocument be context's node document.
To initialize an HTML fragment parser
+ given a Document tempDocument, a Node target,
+ a Node or null redirectTarget, a Node or null
+ referenceChild, a boolean runScripts, a Boolean
+ allowDeclarativeShadowRoots, a SanitizerConfig or null
+ sanitizerConfig, and a boolean safe, run these steps. They return a new
+ HTML parser.
Let contextElement be the + parser context element given + target.
Assert: contextElement is not null.
Let contextDocument be contextElement's node + document.
If contextDocument is in quirks mode, then set
document's mode to "quirks".
Otherwise, if contextDocument is in limited-quirks mode, then set
- document's mode to "tempDocument's mode to "limited-quirks".
Create a new HTML parser whose parser sanitizer configuration is - configuration, allow declarative shadow roots is - allowDeclarativeShadowRoots, scripting mode is - scriptingMode, and remove javascript navigation URLs - is safe, and associate it with document.
Create a new HTML parser, and associate it with + tempDocument.
If contextDocument's scripting is - disabled, then set scriptingMode to Disabled.
Set the parser's parser sanitizer configuration to + sanitizerConfig.
Set the state of the HTML parser's tokenization stage as - follows, switching on context:
+Set the parser's remove javascript navigation URLs to + safe.
titletextareastylexmpiframenoembednoframesscriptnoscriptplaintextSet the parser's script target document to contextDocument if + runScripts is true; otherwise tempDocument.
For performance reasons, an implementation that does not report errors and - that uses the actual state machine described in this specification directly could use the - PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned in the - list above. Except for rules regarding parse errors, they are equivalent, since there is no - appropriate end tag token in the fragment case, yet they involve far fewer state - transitions.
- +Set the parser's parser scripting disabled to contextDocument's + scripting is disabled.
If allowDeclarativeShadowRoots is true, then set the parser's + allow declarative shadow roots to true.
Let root be the result of creating an
- element given document, "html", the HTML
+ element given tempDocument, "html", the HTML
namespace, null, null, false, and the result of looking up a custom element registry given target.
Append root to - document.
Set up the HTML parser's stack of open elements so that it contains just the single element root.
Let fragment be the result of creating - a document fragment given document.
+If redirectTarget is non-null, then:
-The DocumentFragment is created as part of the inert document to
- avoid creation time side effects before sanitization.
If referenceChild is non-null, then set the parser's insertion target + redirection map[root] to be inside redirectTarget, immediately + before referenceChild.
Set the parser's insertion target redirection map[root] to - fragment, right after its last child (if exists).
Otherwise, set the parser's insertion target redirection + map[root] to be inside redirectTarget, right after its last + child (if exists).
If context is a template
+
If contextElement is a template
element, then push "in template" onto the
stack of template insertion modes so that it is the new current template
insertion mode.
Create a start tag token whose name is the local name of context and whose attributes are the attributes of - context.
+ data-x="concept-frag-parse-context">contextElement and whose attributes are the attributes of + contextElement.Let this start tag token be the start tag token of context; e.g. for the purposes of determining if it is + data-x="concept-frag-parse-context">contextElement; e.g. for the purposes of determining if it is an HTML integration point.
Reset the parser's insertion mode appropriately.
- -The parser will reference the context element as part of that algorithm.
Set the HTML parser's form element pointer to the
- nearest node to context that is a
+ nearest node to contextElement that is a
form element (going straight up the ancestor chain, and including the element
itself, if it is a form element), if any. (If there is no such form
element, the form element pointer keeps its initial value,
null.)
Place the input into the input stream for the HTML - parser just created. The encoding confidence is irrelevant.
Return the HTML parser.
The HTML fragment parsing algorithm, given an Element or
+ DocumentFragment target, a string input, an
+ optional boolean allowDeclarativeShadowRoots (default false), an optional boolean
+ runScripts (default false), an optional SanitizerConfig or null
+ sanitizerConfig (default null), and an optional boolean safe (default
+ false), is the following steps. They return a DocumentFragment.
Parts marked fragment case in algorithms in the HTML + parser section are parts that only occur if the parser was created for the purposes of this + algorithm. The algorithms have been annotated with such markings for informational purposes only; + such markings have no normative weight. If it is possible for a condition described as a + fragment case to occur even when the parser wasn't created for the purposes of + handling this algorithm, then that is an error in the specification.
-Start the HTML parser and let it run until it has consumed all the characters +
Let document be a Document node whose type is "html".
Let fragment be the result of creating + a document fragment given document.
+ +The DocumentFragment is created as part of the inert document to
+ avoid creation time side effects before sanitization.
Let parser be the result of invoking initialize an HTML fragment parser with document, target, + fragment, null, runScripts, allowDeclarativeShadowRoots, + sanitizerConfig, and safe.
Place the input into the input stream for parser. + The encoding confidence is irrelevant.
Start parser and let it run until it has consumed all the characters just inserted into the input stream.
Return fragment.