question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dt and dd without end tags went to wrong.

See original GitHub issue

Version

2.4.2

Reproduction link

https://jsfiddle.net/mysticatea/528857L9/1/

Steps to reproduce

  1. 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:closed
  • Created 6 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
yyx990803commented, Aug 29, 2017

So, the rules about omitting end tags in HTML5 is rather case-by-case. For p and li it’s more straightforward since they just close themselves when another one of itself is encountered, however for dt, dd, tr, td and options 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.

0reactions
nickmessingcommented, Jul 30, 2017

@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 or dt inside dd or dt.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found