Google doesn't follow W3C standards... whaaa? [closed]
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?
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.
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.
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.
精彩评论