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

"UA: reset the insertion mode appropriately" algorithm clarification #7263

Open
SoLaRGit opened this issue Oct 26, 2021 · 0 comments
Open

"UA: reset the insertion mode appropriately" algorithm clarification #7263

SoLaRGit opened this issue Oct 26, 2021 · 0 comments
Labels
clarification Standard could be clearer topic: parser

Comments

@SoLaRGit
Copy link

https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately

  1. If node is a select element, run these substeps:​
  1. If last is true, jump to the step below labeled done.

  2. Let ancestor be node.

  3. Loop:​ If ancestor is the first node in the stack of open elements, jump to the step below labeled done.

  4. Let ancestor be the node before ancestor in the stack of open elements.

  5. If ancestor is a template node, jump to the step below labeled done.

  6. If ancestor is a table node, switch the insertion mode to "in select in table" and return.

  7. Jump back to the step labeled loop.

  8. Done:​ Switch the insertion mode to "in select" and return.

  1. If node is a td or th element and last is false, then switch the insertion mode to "in cell" and return.

This text is a little unclear, having actually two algorithms (main and sub-steps of step 4.). Also we have in step 4. sub-steps saying following: "jump to the step below labeled done".
If read literally, it would mean to jump to outer (main) Step 5. "5. If node is a td or th element ...". And if we follow this understanding, we end up having in step 4. sub-step 8. never executed, as step 4. sub-step 7. has text "7. Jump back to the step labeled loop." so we never end in step 4. sub-step 8.
Text needs some clarification or better behavioral algorithmic language (maybe ITU, or ISO standard language style for algorithms like JPEG standard for example).

So is this how algorithm should behave or not!?
Is there any better way of looking the algorithms that are described in html standard?

thank you

@annevk annevk added clarification Standard could be clearer topic: parser labels Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: parser
Development

No branches or pull requests

2 participants