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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

HTML Optional Tags

62 点作者 softskunk超过 1 年前

6 条评论

danbruc超过 1 年前
Would there have been a way to avoid this mess?<p><pre><code> - a browser must reject any invalid HTML in order to force the developers to fix their HTML - a browser must try hard to make sense of messed up HTML, otherwise users will switch to a competing browser that renders the mess for them </code></pre> Theoretically all browser vendors could coordinate so that everyone rejects invalid HTML, but there is probably no good way to avoid defectors. Why did this not happen for other technologies? My first thought was that there is no compilation step which allows forcing the developer to fix things without giving the end user any power through their choice of browser. But that seems not quite right, why do Bash or Python or your C++ compiler not make a best guess what your code is supposed to do? Because there is or was only one dominant implementation and therefore no competition? Because document markup is much more robust against small errors and probably remains readable while your code likely just crashes? That is probably one of the most important ones, I think. What role did browser specific features, evolving standards and incomplete implementations play?<p>What is the end result? Nothing for the end user, they do not care whether the browser has to deal with nice HTML or a mess. Developer writing HTML get to be more sloppy at the price of a lot of additional complexity and pain where ever code has to deal with HTML. This might actually have some negative impact on end users because of bugs or security issues stemming from the additional complexity. Maybe it made HTML somewhat more accessible to the casual user as they could get away with some mistakes. But was this worth it, could better tooling not have achieved the same with good error messages helping to fix errors?
评论 #37507834 未加载
评论 #37506772 未加载
评论 #37510731 未加载
评论 #37509478 未加载
JodieBenitez超过 1 年前
Yes... but why do this ? I don&#x27;t regret the XHTML days and its feature stagnation, but this is just useless.
评论 #37507189 未加载
评论 #37505656 未加载
评论 #37506334 未加载
评论 #37506497 未加载
评论 #37507429 未加载
评论 #37508470 未加载
评论 #37508154 未加载
paulddraper超过 1 年前
And people wonder why XHTML was a thing.<p>(Is still a thing, but W3C recommends against it)
throwaway87651超过 1 年前
Fantastic! These are great suggestions to help write readable, maintainable HTML. Similar to: <a href="https:&#x2F;&#x2F;lofi.limo&#x2F;blog&#x2F;write-html-right" rel="nofollow noreferrer">https:&#x2F;&#x2F;lofi.limo&#x2F;blog&#x2F;write-html-right</a>
mattkenefick超过 1 年前
It bummed me out when modern browsers started supporting mistakes in code; like when Chrome would interpret incorrect markup and fix it for you.
hyperhello超过 1 年前
There is some variant of the theorem about any sufficiently complex language can’t express its own correctness and vice versa. We want to turn all expression failures into syntax errors; but we can’t. Just don’t write bad HTML, bad JavaScript, bad CSS, and there won’t be any trouble for you.