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().

@@ -111438,14 +111436,6 @@ document.body.appendChild(text); -
- -

Speculative HTML parsing

- -

Speculative HTML parser, start the speculative HTML parser, - stop the speculative HTML parser...

- -
@@ -111570,8 +111560,7 @@ document.body.appendChild(text);
  • 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".

  • @@ -111590,6 +111579,127 @@ document.body.appendChild(text);
    +
    + +

    Speculative HTML parsing

    + +

    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:

    + + + +

    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?

    + + + +

    To start the speculative HTML parser for an instance of an HTML parser + parser:

    + +
      +
    1. Optionally, return. (This allows user agents to opt out of speculative HTML + parsing.)

    2. + +
    3. +

      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.

      +
    4. + +
    5. Let speculativeParser be a new speculative HTML parser, with the + same state as parser.

    6. + +
    7. Set parser's active speculative HTML parser to + speculativeParser.

    8. + +
    9. In parallel, run speculativeParser until it is stopped or until it + reaches the end of its input stream.

    10. +
    + + +

    To stop the speculative HTML parser for an instance of an HTML parser + parser:

    + +
      +
    1. Let speculativeParser be parser's active speculative HTML + parser.

    2. + +
    3. If speculativeParser is null, then return.

    4. + +
    5. Throw away any pending content in speculativeParser's input + stream, and discard any future content that would have been added to it.

    6. + +
    7. Set parser's active speculative HTML parser to null.

    8. +
    + +
    + +

    Coercing an HTML DOM into an infoset

    @@ -122755,6 +122865,9 @@ INSERT INTERFACES HERE
    [CSSCOLOR]
    CSS Color Module, T. Çelik, C. Lilley, L. Baron. W3C.
    +
    [CSSDEVICEADAPT]
    +
    CSS Device Adaption, F. Rivoal, M. Rakow. W3C.
    +
    [CSSDISPLAY]
    CSS Display, T. Atkins, E. Etemad. W3C.