Skip to content

Commit

Permalink
Stop reporting redundant fragment parser error in foreign content
Browse files Browse the repository at this point in the history
I have tested this change against the test cases from html5lib-tests.

In document parsing this doesn't change any test results.

In fragment parsing this fixes 7 test cases by reporting one parser
error less. (That is all existing HTML parsers that pass html5lib-tests
must have already implemented these steps in the order they are changed
to by this commit.)

The test cases where one error is reported less fall in two categories:

* fragment parsing e.g. `<svg></table>` with a `tbody` HTML element as
  the context element => one "unexpected end tag" error is reported less
  (previously it was reported twice)

* fragment parsing e.g. `<g></path>` with a `path` SVG element as the
  context element => one "found special tag while closing generic tag"
  error is no longer reported

Fixes html5lib/html5lib-tests#173.
  • Loading branch information
not-my-profile committed Sep 29, 2023
1 parent c63f712 commit d119c56
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -126934,18 +126934,18 @@ document.body.appendChild(text);
<li><p><i>Loop</i>: If <var>node</var> is the topmost element in the <span>stack of
open elements</span>, then return. (<span>fragment case</span>)</p></li>

<li><p>If <var>node</var> is an element in the <span>HTML namespace</span>,
process the token according to the rules given in the section corresponding
to the current <span>insertion mode</span> in HTML content.</p></li>

<li><p>If <var>node</var>'s tag name, <span>converted to ASCII lowercase</span>, is
the same as the tag name of the token, pop elements from the <span>stack of open
elements</span> until <var>node</var> has been popped from the stack, and then return.</p></li>

<li><p>Set <var>node</var> to the previous entry in the <span>stack of open
elements</span>.</p></li>

<li><p>If <var>node</var> is not an element in the <span>HTML namespace</span>, return
to the step labeled <i>loop</i>.</p></li>

<li><p>Otherwise, process the token according to the rules given in the section corresponding
to the current <span>insertion mode</span> in HTML content.</li>
<li><p>Return to the step labeled <i>loop</i>.</p></li>
</ol>
</dd>
</dl>
Expand Down

0 comments on commit d119c56

Please sign in to comment.