-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"p" tag can't have close tag? #5049
Comments
The That means, That would work: <script>
let name = 'world';
</script>
<p>
<pre>{name}</pre> |
Yes. This is actually invalid HTML but browsers will do their best with it regardless. Svelte is much stricter and won’t parse invalid HTML. The auto closing behaviour is a little confusing, however. |
I'm not sure what preferred behavior would be here. Browsers really do autoclose the |
Yeah, I think so. Browsers do autoclose paragraphs, amongst many other things they do to recover from invalid code but they also don't throw parsing errors. I don't think many of the 'lets try to make it work' features of browsers are widely known. With the above example, not only does chrome autoclose the first Ideally when seeing a close tag without an open tag, after autoclosing a tag of the same type, we could give a more descriptive error. However, I don't know if the parser is setup to handle this kind of error reporting. We would need to make sure we retained that information. There are possibly a bunch of edge cases that could make this doubly confusing. |
I'm removing the |
In 3.24.1 there's now a more helpful error message if the parser encounters a closed tag that previously had been autoclosed by opening another tag. |
Describe the bug
The
</p>
tag is not parsed correctly:The result is:
</p> attempted to close an element that was not open (7:0)
Information about your Svelte project:
Severity
Additional context
The text was updated successfully, but these errors were encountered: