Mark Pilgrim has released Google Doctype, an open encyclopedia and reference library. Written by web developers, for web developers. It includes articles on web security, JavaScript DOM manipulation, CSS tips and tricks, and more.

The reference section includes a growing library of test cases for checking cross-browser and cross-platform compatibility.

This is just the beginning for the ambitious project, which is open source, and open licensed (Creative Commons). Now it is out there we, the developers, have the option to add valuable data to grow the corpus.

Congrats to Mark on the launch. I know that it has been a huge amount of work for him, and I am excited to see it out there. Below is Mark talking about the project:

You may also notice the document reader application, which is driven by GWT.

The goog js library is conceptually pretty clean, but it certainly is bloated. I think somewhere along the development path they forgot they were developing for the web. Big libraries don’t serve fast.

Comment by Anonymous — May 15, 2008

Google must have an internal JS compiler to remove bloat. Take a look at the source, there is reference to if(!COMPILED) a bunch of times, as well as talk about command line parameters to the compiler. Also, notice how alot of the method names have suffixes? I would bet that they use an internal naming scheme to somehow specify private vs public symbols. A private symbol is one that can be removed if it is not used, and can be obfuscated. A public would be one that can’t be removed because you don’t know who is going to call it, and you can’t rename/obfuscate it either.

This is one of the ways JS developers can approach the way GWT works. You invent a new DSL, call it JS++, where you adhere to a certain idiomatic naming scheme, package scheme, etc. You might even use JSDoc to declare types. Then, you build a bunch of command line tools to process the JS based on required idioms, and as long as people adhere to the idioms, you can aggressively optimize and package the JS.

Much of the perceived “bloat” is probably due to maintaining idiomatic format for everything. For example, if they were to use other techniques like defining methods by looping over an array (e.g. [“foo”, “bar”, “baz”].each(function(name) { window[name] = … } ) as some JS libraries do, it would totally break assumptions that a compiler makes.

I would bet that Google’s JS library in practice produces smaller code downloaded than most of the JS libraries on the internet which use open source packers/minifiers.