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.

"Unexpected closing tag" error

See original GitHub issue

When formatting the following code

<div class="account" >
  <div class="accounttitle" >
    <p >Account</p>
        <DynamicTooltip content={$t(message) || ''} >
        <Icon icon={{ name: 'info_outline' }}  />
          </DynamicTooltip >
  </div >
</div >
 
<script>
  /* JavaScript goes here... */
</script>

I get an error:

  9 |  
SyntaxError: Unexpected closing tag "DynamicTooltip". It may happen when the tag has already 
been closed by another tag. For more info see 
https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (6:7)
  4 |         <DynamicTooltip content={$t(message) || ''} >
  5 |         <Icon icon={{ name: 'info_outline' }}  />
> 6 |       </DynamicTooltip >
    |       ^
  7 |   </div >
  8 | </div >

If don’t use || in the 4th line of the original code, the error doesn’t appear.

I’m using the latest version of Prettier from GitHub, and version 1.1.0 of prettier-plugin-svelte

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
sassmancommented, May 21, 2020

@mikenikles I never thought much about it, but sure, it does not make sense to nest them but that it is actually by spec forbidden, I had no idea.

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

Thanks for highlighting that

0reactions
dummdidummcommented, Sep 3, 2020

No longer reproducible with the latest version of Svelte, Prettier and prettier-plugin-svelte.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected closing tag "div" error angular2 HTML
This error occurred when you open an element and don't close its. this error shows up in this example ...
Read more >
Angular Error: Template parse errors: Unexpected closing tag ...
Angular Error: Template parse errors: Unexpected closing tag “a”. It may happen when the tag has already been closed by another tag.
Read more >
Hugo, Prettier, and "SyntaxError: Unexpected closing tag"
Like many, I have opened the body tag in a header. html file and am closing it in the footer. html file.
Read more >
Unexpected closing tag« when go-template blog is inside of ...
SyntaxError: Unexpected closing tag "BPGT25EPGT". It may happen when the tag has already been closed by another tag.
Read more >
TIP : Blazor Unexpected closing tag 'div' with no matching start ...
We get this error “ RZ9981 Unexpected closing tag 'div' with no matching start tag.” The little trick is to use either.
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