TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Rich Harris: Svelte parses HTML all wrong

26 点作者 bundie大约 1 年前

4 条评论

jitl大约 1 年前
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.
fifilura大约 1 年前
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.<p><a href="https:&#x2F;&#x2F;htmlparser.info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;htmlparser.info&#x2F;</a><p>This chapter <a href="https:&#x2F;&#x2F;htmlparser.info&#x2F;conformance-checkers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;htmlparser.info&#x2F;conformance-checkers&#x2F;</a> lists &quot;Self closing tags&quot; behind 2.46% of the errors at the time of writing.<p>I believe there is some reference implementation somewhere too, but I couldn&#x27;t find it.
hk1337大约 1 年前
I thought &quot;self-closing&quot; tags went away after HTML5 came along? Also not all tags are &quot;self-closing&quot;.<p><a href="https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;syntax.html#void-elements" rel="nofollow">https:&#x2F;&#x2F;html.spec.whatwg.org&#x2F;multipage&#x2F;syntax.html#void-elem...</a><p>div was never &quot;self-closing&quot;, iirc.
7bit大约 1 年前
I&#x27;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&#x27;d like to assume that whatever is wrong HTML should also be wrong Svelte-template-language.<p>I really don&#x27;t understand how people can defend using the self-closing div&#x27;s etc, when this just contributes to the same set of problems they are criticising in the same sentence :smh:<p>Glad Rich is seeing it the same way and moves forward with fixing this!
评论 #39943154 未加载