From d04ee3d877439271c6bebb9fbea52b40a2c61cab Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 29 Sep 2023 08:12:23 +0200 Subject: [PATCH] Stop reporting redundant fragment parser error in foreign content 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. `` 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. `` with a `path` SVG element as the context element => one "found special tag while closing generic tag" error is no longer reported Fixes https://github.com/html5lib/html5lib-tests/issues/173. --- source | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source b/source index 4adc4f275bc..4919188b2d6 100644 --- a/source +++ b/source @@ -126934,6 +126934,10 @@ document.body.appendChild(text);
  • Loop: If node is the topmost element in the stack of open elements, then return. (fragment case)

  • +
  • If node is an element in the HTML namespace, + process the token according to the rules given in the section corresponding + to the current insertion mode in HTML content.

  • +
  • 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.

  • @@ -126941,11 +126945,7 @@ document.body.appendChild(text);
  • Set node to the previous entry in the stack of open elements.

  • -
  • If node is not an element in the HTML namespace, return - to the step labeled loop.

  • - -
  • Otherwise, process the token according to the rules given in the section corresponding - to the current insertion mode in HTML content.

  • +
  • Return to the step labeled loop.