I was looking at the sourcecode of google.com (the web-rendered version ofc. ;-)) and I noticed that they don't always use double quotes around the values of some HTML attributes, like:
<a onclick=gbar.qs(this) class=gbmt id=gb_10 href="http://books.google.com/bkshp?hl=en&tab=wp&authuser=0" onclick="gbar.logger.il(1,{t:10})">Books</a>
What's the advantage of coding your site like this?
source: www.google.com
The HTML specification says: Attributes are placed inside the start tag, and consist of a name and a value, separated by an = character. The attribute value can remain unquoted if it doesn't contain spaces or any of " ' ` = < or > . Otherwise, it has to be quoted using either single or double quotes.
The double quote ( " ) has special meaning inside a HTML attribute. If you want to put it into an attribute value, you must (this is not a true must but a good rule of thumb. It's a must if you use attributes delimited by double-quotes as you do in your question) write it as its entity " .
The HTML standard does not require quotes around attribute values. However, W3C recommends quotes in HTML, and demands quotes for stricter document types like XHTML.
Because HTML doesn't care. Quotes are not required. In the case of a boolean attribute, it doesn't even need a value either at times (ex. disabled
vs. disabled="disabled"
). Only XML (and XHTML served with an XML mimetype) cares about syntax in this way because XML spec defines these are required.
I believe this is done to minimize the size of HTML of the page as much as possible. Because when you are serving as many pages as google every byte counts. I remember quite a while ago there was an article about it. They also don't close a lot of the opening tags and some other stuff.
EDIT: Found the article from 2 years ago: http://blog.errorhelp.com/2009/06/27/the-highest-traffic-site-in-the-world-doesnt-close-its-html-tags/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With