Making AJAX faster, smaller, more compatible

Two major problems I’ve faced when writing AJAX web-applications are (1) data size, and (2) browser compatibility. The fact is that it’s a hell of a lot easier to have a page fragment come over the connection to you, rather than a DOM which you then have to convert to HTML. However, this approach pushes a lot more data across the connection than is necessary. I know, why should I be worried about a few extra K online; most browsers can handle a GZIP stream, etc. etc. etc. Well the fact is most sites don’t use the fact that their clients can handle compressed data, they just send large lumps of bits back to the browsers, over, and over, and over again. Sure bandwidth is mostly cheap, but the fact is, pushing to much data is just a waste.

Where am I heading with this? I still haven’t touched on browser compatibility. It’s not JavaScript compatibility I’m talking about either, it’s HTML compatibility. Anyone developing a web-site faces this problem. Well, I’ve found a (sort of) solution to both problems. It’s a Google Code project called ajaxslt, and it’s an implementation of XSLT in JavaScript. So you specify some XSLT sheets to transform the XML that you send of the network. Much neater!