From fa936ea6a6a9d51cc689d4737378c4eaec7d8f1b Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Thu, 9 Sep 2021 01:04:23 +0200 Subject: [PATCH] WIP scripting --- manuscript/scripting.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/manuscript/scripting.md b/manuscript/scripting.md index 7efdf6e..5c35fdd 100755 --- a/manuscript/scripting.md +++ b/manuscript/scripting.md @@ -6,12 +6,22 @@ nextTitle: Serializing --- # Chapter 4. Scripting complications +Implementations of HTML that do not need to support executing scripts are exempt from various complications, in particular the necessary hoops for `document.write()`. Browsers that wish to be compatible with the vast majority of the web will have to support scripting, and jump through the hoops with elegance. + ## Revised overview of the HTML parser -TODO +Because of `document.write()`, the {% ref "parser", "overview of the HTML parser" %} in {% ref "parser", "Chapter 3. The HTML parser" %} is incomplete. + +The HTML standard has this diagram: + +![]() ## `document.write()` +A script in an inline `` end tag. The parser is blocked until the script has completed. If the script calls `document.write()`, the characters passed in are added to the parser's input stream. The algorithm for `document.write()` makes the HTML parser consume those characters, before returning (i.e., before allowing the next statement in the script run). + +What if those characters are ``? Then you have to execute that script before the `document.write()` can return. What if that script `document.write()`s another script? Yes, I suppose you get the picture. (TODO discuss nested document.write limit.) + TODO ### Blocking the parser @@ -22,6 +32,8 @@ TODO TODO +## The scripting flag and the `noscript` element + ## Other parser APIs TODO