Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<!doctype html><script><! has only one error #110

Closed
wants to merge 1 commit into from

Conversation

stevecheckoway
Copy link
Contributor

Here are the (abbreviated) steps (intermingling the tree-construction
and tokenizer).

  1. <script> token causes html and head elements to be inserted and
    is processed in the "in head" insertion mode
  2. <script> token switches the tokenizer to the script data state and
    switches to the "text" insertion mode
  3. < switches to the script data less-than sign state
  4. ! switches to the script data escape start state and emits <!
  5. EOF is reconsumed in the script data state
  6. EOF emits an EOF token
  7. EOF token (in the "text" insertion mode) is a parse error,
    <script> is popped off the stack of open elements, switches back to
    the "in head" insertion mode and reprocesses the token
  8. EOF token (in "in head") triggers the "anything else clause" which
    pops the head element, switches to "after head", inserts a body
    token, switches to "in body", and reprocesses
  9. EOF token (in "in body") stops parsing with no error because the
    stack of open elements contains html and body

Only step 7 adds a parse error.

Here are the (abbreviated) steps (intermingling the tree-construction
and tokenizer).

1. `<script>` token causes `html` and `head` elements to be inserted and
   is processed in the "in head" insertion mode
2. `<script>` token switches the tokenizer to the script data state and
   switches to the "text" insertion mode
3. `<` switches to the script data less-than sign state
4. `!` switches to the script data escape start state and emits `<!`
5. EOF is reconsumed in the script data state
6. EOF emits an EOF token
7. EOF token (in the "text" insertion mode) is a parse error,
   `<script>` is popped off the stack of open elements, switches back to
   the "in head" insertion mode and reprocesses the token
8. EOF token (in "in head") triggers the "anything else clause" which
   pops the `head` element, switches to "after head", inserts a `body`
   token, switches to "in body", and reprocesses
9. EOF token (in "in body") stops parsing with no error because the
   stack of open elements contains `html` and `body`

Only step 7 adds a parse error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant