whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.03k stars 2.62k forks source link

Spec is missing that </p> is optional before <dialog> #10590

Closed laughinghan closed 2 weeks ago

laughinghan commented 2 weeks ago

What is the issue with the HTML Standard?

The closing paragraph tag </p> is optional if the paragraph is followed by a block-level element such as another paragraph, a div, etc, as specced here: https://html.spec.whatwg.org/multipage/syntax.html#optional-tags:the-p-element

(By "block-level element" I mean elements that are in the flow content category but not in the phrasing content category, which are traditionally display: block by default in user agent stylesheets.)

This list is missing the <dialog> element however, even though <dialog> does break paragraphs in at least latest Chrome, Safari, and Firefox, try it here: https://output.jsbin.com/qoniver

<dialog> is the only block-level element missing from that list, and in-the-wild implementations behave as if it is in the list; presumably that's a typo and it's supposed to be there.

annevk commented 2 weeks ago

Well spotted, that indeed appears to be an oversight.)

(Though note that the correct motivation here would be something like https://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cp%3EA%3Cdialog%3E which shows that <dialog> indeed pops a p element of the stack. While the user agent style sheet is perhaps somewhat indicative, it's not directly responsible for any of this.)

annevk commented 2 weeks ago

The summary element is also missing, but that appears to be correct as the only conforming place to use that element is as the first child of details so it cannot be preceded by p in a conforming document.