JavaScript Knowledge Base (JSKB) optimizes Code Bloat

JavaScript libraries let developers do more with less code. But JS libraries need to work on a variety of browsers, so using them often means shipping even more code. If JQuery has code to support XMLHttpRequest over ActiveX on an older browser like IE6 then you end up shipping that code even if your app […]

JavaScript libraries let developers do more with less code. But JS libraries need to work on a variety of browsers, so using them often means shipping even more code. If JQuery has code to support XMLHttpRequest over ActiveX on an older browser like IE6 then you end up shipping that code even if your app doesn't support IE6. Not only that, but you ship that code to other 90% of newer browsers that don't need it. This problem is only going to get worse. Browsers are rushing to implement HTML5 and EcmaScript5 features like JSON.parse that used to be provided only in library code, but libraries will likely have to keep that code for years if not decades to support older browsers.

Lots of compilers (incl. (JSMin, Dojo, YUI, Closure, Caja) remove unnecessary code from JavaScript to make the code you ship smaller. JavaScript Knowledge Base (JSKB) seeks to systematically capture this information in a way that compilers can use. It collects facts about browsers using JavaScript snippet. The Caja team just released Caja Web Tools, which already uses JSKB to optimize code.

[SAource]