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

The section "The stack of open elements" needs some explanation. #10285

Closed
dSalieri opened this issue Apr 18, 2024 · 1 comment
Closed

The section "The stack of open elements" needs some explanation. #10285

dSalieri opened this issue Apr 18, 2024 · 1 comment

Comments

@dSalieri
Copy link

dSalieri commented Apr 18, 2024

What is the issue with the HTML Standard?

The stack of open elements is said to have an element target node in a specific scope consisting of a list of element types list when the following algorithm terminates in a match state:

  1. Initialize node to be the current node (the bottommost node of the stack).
  2. If node is the target node, terminate in a match state.
  3. Otherwise, if node is one of the element types in list, terminate in a failure state.
  4. Otherwise, set node to the previous entry in the stack of open elements and return to step 2. (This will never fail, since the loop will always terminate in the previous step if the top of the stack — an html element — is reached.)

Why has the have an element target node in a specific scope such name (step number 3 shows that element mustn't match with list)?


The stack of open elements is said to have a particular element in scope when it has that element in the specific scope consisting of the following element types:

This list (blacklist), why such a set of exceptions? For example, not all objects are from MathML and SVG. Accordingly, it is simply impossible to understand the meaning of the statements that uses this list.

@zcorpan
Copy link
Member

zcorpan commented Jun 12, 2024

Why has the have an element target node in a specific scope such name (step number 3 shows that element mustn't match with list)?

Look at e.g. "A start tag whose tag name is "button"" for how this is used. <button><span><button> needs to close the first button, but <button><object><button> should instead nest (the ancestor button is not "in scope").

This list (blacklist), why such a set of exceptions? For example, not all objects are from MathML and SVG. Accordingly, it is simply impossible to understand the meaning of the statements that uses this list.

applet, caption, table, td, th, marquee, object are needed for compat with existing content (pre HTML parser spec era). html because it's the root element (also in the fragment case). template I believe was added here to get the right behavior when that element was added. The listed MathML and SVG elements are integration points where you can use HTML elements again, see https://html.spec.whatwg.org/#tree-construction

Generally, the spec doesn't explain all design decisions or rationale since it would at least 10x the size of the spec.

@zcorpan zcorpan closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants