HTML parser: <dialog> does not close <p>

Issue #11372968 • Assigned to Travis L.

Details

Author
Simon P.
Created
Mar 23, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
  • Chrome
  • Safari
  • Opera
Found in build #
13
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Version: Release 26 (Safari 10.2, WebKit 12604.1.12)

Test: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4976

Result in Chrome canary:
log: <dialog><p></dialog>x
log: <p><dialog>
log: DONE

Expect:
log: DONE

The HTML parser does not close the p for </dialog> in the first test, and doesn’t close the p for <dialog> in the second test.

HTML standard:
[[
A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", “ul”
If the stack of open elements has a p element in button scope, then close a p element.

Insert an HTML element for the token.
]]

[[
An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary", “ul”
[…handling of end tag…]
]]

html5lib-tests PR:
https://github.com/html5lib/html5lib-tests/pull/91

Test passes in Firefox Nightly. Fails in Chrome canary and Safari TP.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

    • We are not able to access the repro test URL.  Would you mind updating this bug with an updated repro URL?

      Appreciate the help,

      The MS Edge Team

    • https://jsbin.com/xotivuyoro/1/edit?html,console

      There should be no false in the console.

    • The test code in case jsbin happens to be down as well

      
      
      
    • Huh, that got the tags stripped. :-( Trying again (with <script> var div = document.createElement('div'); var tags = ["address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary", "ul"]; tags.forEach((tag) => { testPinElm(tag); testElmAfterP(tag); }); console.log('DONE'); function testPinElm(tag) { const input =<${tag}><p></${tag}>x; div.innerHTML = input; console.assert(div.childNodes.length === 2, input); } function testElmAfterP(tag) { const input =<p><${tag}>`;
      div.innerHTML = input;
      console.assert(div.childNodes.length === 2, input);
      }

      </script>

    • <!DOCTYPE html>
      <script>
      var div = document.createElement('div');
      var tags = ["address", "article", "aside", "blockquote", "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary", "ul"];
      tags.forEach((tag) => {
        testPinElm(tag);
        testElmAfterP(tag);
      });
      console.log('DONE');
      function testPinElm(tag) {
        const input = `<${tag}><p></${tag}>x`;
        div.innerHTML = input;
        console.assert(div.childNodes.length === 2, input);
      }
      function testElmAfterP(tag) {
        const input = `<p><${tag}>`;
        div.innerHTML = input;
        console.assert(div.childNodes.length === 2, input);
      }
      
      </script>
      
    • Hi zcorpan,

      Thank you for repro.  I was able to repro this in the latest builds.

      I appreciate the quick response and the extensive support,

      regards,

      The MS Edge Team

    • Microsoft Edge Team

      Changed Assigned To to “Travis L.”

      Changed Title from “HTML parser: <dialog> does not close <p>” to “HTML parser: <dialog> does not close <p>”

    You need to sign in to your Microsoft account to add a comment.

    Sign in