diff --git a/source b/source index d677ac05762..37c3ac024c9 100644 --- a/source +++ b/source @@ -111086,8 +111086,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().

@@ -112665,14 +112663,6 @@ document.body.appendChild(text); -
- -

Speculative HTML parsing

- -

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

- -
@@ -112797,8 +112787,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".

  • @@ -112817,6 +112806,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

    @@ -123986,6 +124096,9 @@ INSERT INTERFACES HERE
    [CSSCOLORADJUST]
    CSS Color Adjustment Module, E. Etemad, R. Atanassov, R. Lillesveen, T. Atkins. W3C.
    +
    [CSSDEVICEADAPT]
    +
    CSS Device Adaption, F. Rivoal, M. Rakow. W3C.
    +
    [CSSDISPLAY]
    CSS Display, T. Atkins, E. Etemad. W3C.