diff --git a/source b/source index c1b64ffe204..0c82f0a5509 100644 --- a/source +++ b/source @@ -109859,8 +109859,6 @@ document.body.appendChild(text); invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume when the caller returns to the "outer" tree construction stage.)
-Speculatively parse the remainder of the document.write string here?
-The tree construction stage of this particular parser is being called reentrantly, say from a call to document.write()
.
Speculative HTML parser, start the speculative HTML parser, - stop the speculative HTML parser...
- -Throw away any pending content in the input stream, and discard any future content that would have been added to it.
If there is an active speculative HTML parser, stop the speculative - HTML parser for this HTML parser.
Stop the speculative HTML parser for this HTML parser.
Set the current document readiness to "interactive
".
User agents may implement an optimization, as described in this section, to speculatively fetch + resources that are declared in the HTML markup while the HTML parser is waiting for a + pending parsing-blocking script to be fetched and executed. While this optimization + is not defined in precise detail, there are some rules to consider for interoperability.
+ +Each HTML parser can have an active speculative HTML parser. It + is initially null.
+ +The speculative HTML parser must act like the normal HTML parser (e.g., the + tree builder rules apply), with some exceptions:
+ +Scripts must not be executed.
Character encoding declarations must be ignored.
The state of the normal HTML parser and the document itself must not be affected.
+ +For example, the next input character or the stack of open + elements for the normal HTML parser is not affected by the speculative HTML + parser.
+The result of the speculative parsing is primarily a series of speculative + fetches. Which kinds of resources to speculatively fetch is + implementation-defined, but user agents must not speculatively fetch resources that + would not be fetched with the normal HTML parser, under the assumption that the script that is + blocking the HTML parser does nothing.
+ +It is possible that the same markup is seen multiple times from the + speculative HTML parser and then the normal HTML parser. It is expected that + duplicated fetches will be prevented by normal caching rules.
+The speculative fetches must follow these rules:
+ +Should some of these things be applied to the document "for real", even + though they are found speculatively?
+ +Let the HTML parser's invocation of the application + cache selection algorithm complete before initiating any speculative fetches, if + applicable.
If the speculative HTML parser encounters one of the following elements, then + act as if that element is processed for the purpose of its effect of speculative fetches for + resources after the element.
+ +base
element.meta
element whose http-equiv
+ attribute is in the Content
+ security policy state.meta
element whose name
attribute is an
+ ASCII case-insensitive match for "referrer
".meta
element whose name
attribute is an
+ ASCII case-insensitive match for "viewport
". (This can
+ affect whether a media query list matches the environment.) To start the speculative HTML parser for an instance of an HTML parser + parser:
+ +Optionally, return. (This allows user agents to opt out of speculative HTML + parsing.)
If parser already has an active speculative HTML parser, then + stop the speculative HTML parser for parser.
+ +This can happen when document.write()
writes another
+ parser-blocking script. For simplicity, this specification always restarts speculative parsing,
+ but user agents can implement a more efficient strategy, so long as the end result is
+ equivalent.
Let speculativeParser be a new speculative HTML parser, with the + same state as parser.
Set parser's active speculative HTML parser to + speculativeParser.
In parallel, run speculativeParser until it is stopped or until it + reaches the end of its input stream.
To stop the speculative HTML parser for an instance of an HTML parser + parser:
+ +Let speculativeParser be parser's active speculative HTML + parser.
If speculativeParser is null, then return.
Throw away any pending content in speculativeParser's input + stream, and discard any future content that would have been added to it.
Set parser's active speculative HTML parser to null.