Hacker News new | past | comments | ask | show | jobs | submit login
Rich Harris: Svelte parses HTML all wrong (github.com/sveltejs)
26 points by bundie 25 days ago | hide | past | favorite | 8 comments



I really appreciate that JSX normalized self-closing tags, even if it’s not “html standard”, and I’m somewhat sad to lose that nicety in Svelte. In my view Svelte is plenty weird enough to not be HTML already, but I guess the framework owner differs.


Relevant book to use as reference. Written by Simon who worked with web standards at Opera. The race to conform with whatever browser had the biggest market share that day (typically IE, or Chrome) - meant a lot of reverse engineering.

https://htmlparser.info/

This chapter https://htmlparser.info/conformance-checkers/ lists "Self closing tags" behind 2.46% of the errors at the time of writing.

I believe there is some reference implementation somewhere too, but I couldn't find it.


I thought "self-closing" tags went away after HTML5 came along? Also not all tags are "self-closing".

https://html.spec.whatwg.org/multipage/syntax.html#void-elem...

div was never "self-closing", iirc.


I'm so happy he realized this behaviour is not good. I understand that svelte templates are not HTML (but a superset as he says), so I'd like to assume that whatever is wrong HTML should also be wrong Svelte-template-language.

I really don't understand how people can defend using the self-closing div's etc, when this just contributes to the same set of problems they are criticising in the same sentence :smh:

Glad Rich is seeing it the same way and moves forward with fixing this!


If Svelte templates really are a strict superset of HTML, then doesn't that mean by definition that there is "wrong HTML" that is valid Svelte?

That would only not be true if Svelte was a sub-set.


[flagged]


This is a github issue to discuss this topic, not a breaking change.


Are you serious? Is this really a github issue? Thank you very much. I didn't realize this at all when I entered the page.


What I meant to say is that if when somebody both admits their misunderstanding , admits it, then starts a discussion on what to do about it, then I don't understand the "this guy is a joke" part. Don't you wish everyone was like that?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: