html5lib / html5lib-tests

Testsuite data for html5lib, including the de-facto standard HTML parsing tests.
MIT License
188 stars 61 forks source link

7 tests assume non-compliant step-order in foreign content #173

Open not-my-profile opened 1 year ago

not-my-profile commented 1 year ago

The rules for parsing tokens in foreign content currently say:

Any other end tag Run these steps:

  1. Initialize node to be the current node (the bottommost node of the stack).
  2. If node's tag name, converted to ASCII lowercase, is not the same as the tag name of the token, then this is a parse error.
  3. Loop: If node is the topmost element in the stack of open elements, then return. (fragment case)
  4. If node's tag name, converted to ASCII lowercase, is the same as the tag name of the token, pop elements from the stack of open elements until node has been popped from the stack, and then return.
  5. Set node to the previous entry in the stack of open elements.
  6. If node is not an element in the HTML namespace, return to the step labeled loop.
  7. Otherwise, process the token according to the rules given in the section corresponding to the current insertion mode in HTML content.

However if you actually implement that 7 tree-construction test cases of this repository fail:

Apparently the test cases assume that the 7th step is performed as step 4.

annevk commented 1 year ago

Assuming all browsers pass these tests, this is probably best reported as a bug against the standard at this point.

not-my-profile commented 1 year ago

Oh yeah ... I should have noted that the only thing that changes if you do it in the order described as in the spec you get one parser error more ... I'll make a PR to the spec.