dt and dd without end tags went to wrong.
See original GitHub issueVersion
2.4.2
Reproduction link
https://jsfiddle.net/mysticatea/528857L9/1/
Steps to reproduce
- Write
<dt>
and<dd>
without their end tags by turns in a template (except DOM template). For example:
<dl>
<dt>Title 1
<dd>Details 1
<dt>Title 2
<dd>Details 2
</dl>
What is expected?
The DOM tree will become:
<dl>
<dt>Title 1</dt>
<dd>Details 1</dd>
<dt>Title 2</dt>
<dd>Details 2</dd>
</dl>
What is actually happening?
The DOM tree became:
<dl>
<dt>
Title 1
<dd>
Details 1
<dt>
Title 2
<dd>Details 2</dd>
</dt>
</dd>
</dt>
</dl>
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
How to style dt and dd so they are on the same line?
This can be accomplished by adding a DIV element with the CSS overflow: hidden; around the content of the DD tag. You can...
Read more ><dd>: The Description Details element - HTML - MDN Web Docs
Flow content. The start tag is required. The end tag may be omitted if this element is immediately followed by another <dd> element...
Read more >Closing tag matches nothing with dl/dd elements in <p>. Or wrong ...
Gives an error: Closing tag matches nothing. But with div (blocking element) or span (inline element) it looks like working correcntly.
Read more >Error Explanations for The W3C Markup Validation Service
68: end tag for X omitted, but its declaration does not permit this ... list items (<ul> and <ol> require <li>; <dl> requires...
Read more >Optional closing tags in HTML - tempertemper
It's not for every element · <html> · <head> · <body> · <p> · <li> · <dt> · <dd> · <option> ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, the rules about omitting end tags in HTML5 is rather case-by-case. For
p
andli
it’s more straightforward since they just close themselves when another one of itself is encountered, however fordt
,dd
,tr
,td
andoptions
etc., each of them can be terminated by an open tag of itself or some other element, so if we want to strictly adhere to the spec we’d have to hard-code all these possibilities, which imo is not worth it just so that users can intentionally write spec-compliant but (imo) sloppy HTML.Since we already have the closing tag warning in place, we are essentially enforcing Vue templates to be a (slightly) stricter subset of HTML, which imo is fine considering the tradeoff here.
@mysticatea, I still it should be changed because at the moment it works differently from HTML specification, according to specs it should not be possible to have
dd
ordt
insidedd
ordt
.