Google 不遵循 W3C 标准...哇?
我的一个朋友刚刚指出了一个有趣的现象...我访问了 Google 主页并查看了源代码:
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title>
...
...
...
A LOT OF STUFF HERE
...
...
...
</script>
...所以我注意到源代码没有结束 和
标签。使用 Chrome 的检查器,它显示结束标签,但是当我右键单击并查看源代码时,它不在那里。
这是怎么回事?我错过了什么吗?我尝试使用 W3C HTML 验证器,它显示了一堆错误...
http://validator.w3.org/check?verbose=1&uri =http://www.google.com/
那么...这是怎么回事?
A friend of mine just pointed out an interesting phenomenon... I went to the Google home page and looked at the source code:
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title>
...
...
...
A LOT OF STUFF HERE
...
...
...
</script>
... so I noticed that source code doesn't have the closing </body>
and </html>
tags. Using Chrome's Inspector, it shows the closing tags but when I right click and look at the source, its not there.
What is going on here? Am I missing something? I tried using the W3C HTML Validator and it showed a bunch of errors...
http://validator.w3.org/check?verbose=1&uri=http://www.google.com/
So... what's the deal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Google 有一个半官方答案,作为 youtube 视频。
基本上,考虑到他们正在处理数以亿计的数据对于请求,他们尝试最小化每个请求发送的字节数。这是验证、大小以及与网络上使用的不同浏览器的兼容性之间的权衡。
Google has a semi-official answer as a youtube video.
Basically when considering they're handling hundreds of millions of requests, they try to minimise the number of bytes sent per request. It's a tradeoff between validation, size and compatibility with different browsers used across the web.
现实世界中没有哪个浏览器会真正拒绝无效的 HTML。谷歌更关心支持许多不同的浏览器,并将其主页优化到字节级别。我不知道他们对优化如此迂腐的做法是否正确,但他们确实提供了很多页面。
No real-world browser actually rejects invalid HTML. Google is more concerned about supporting lots of different browsers, and optimising their home page down to the byte level. Whether they are right to be so pedantic about optimisation, I don't know, but they sure do serve a lot of pages.
在这里查看一些答案
是否需要写HEAD、BODY和HTML标签?
W3C 验证表明它是有效的。从 HTML 4.
此外,在 HTML5 中,不存在确切的“必需”或“可选”元素,因为 HTML5 语法的定义更为宽松。
See some answers here
Is it necessary to write HEAD, BODY and HTML tags?
W3C Validation says it's valid. From html 4.
Also In HTML5, there are no "required" or "optional" elements exactly, as HTML5 syntax is more loosely defined.