Tuesday, June 26th, 2007
There has been a lot of talk in the Digg community about their new comment system. Joe Stump implemented the new system, and in the process he took out Script.aculo.us, and created a jQuery plugin based solution.
By far the most complex portion of the comments system was how dynamic it was going to be. Threads would be zipping in and out, weâ€™d be creating 90% of the HTML dynamically in the DOM from JSON, posting and editing over AJAX, etc. It was during design that Micah and I also plotted to remove script.aculo.us and replace it with the smaller jQuery library. The entire comment system is, in fact, a series of jQuery plugins.
Probably the coolest, technically speaking, portion of the new comments is the manner in which most of the page is created. No longer do we create static HTML in PHP and send you a huge HTML page. Instead we give you the basics and, via AJAX/JSON, we make requests to the API and dynamically create the DOM using the FlyDOM jQuery plugin. The FlyDOM JSON templates are a stroke of genius if youâ€™re looking at loading JSON dynamically into the DOM. The advantage of this is that initial page loads are much snappier and you can load the threads you wish to read on demand.
There are a lot of comments on whether this is actually better, with shots like “use innerHTML instead” and “now if I have JS turned off I am on of luck”.
Posted by Dion Almaer at 7:33 am