Do as I Say, Not as I Write
"I’ve written a book about DOM scripting but if you can avoid using it, avoid using it."
So said Jeremy ‘DOM Scripting Task Force member, author of Dom Scripting‘ Keith during the AJAX workshop that he was fronting on Friday. There should have been a revolt on the back row, being as Molly and I, both WaSP members and therefore duty-bound to nag anyone within earshot about the importance of standards, were sat there taking it all in. But instead, we just laughed (and I made a note of the memorable quote on the inside cover of said book). The point Jeremey was making was that DOM scripting has its place, but when its mixed with AJAX-like technologies, sometimes making lots of finnickety changes with DOM script commands is overcomplicating things somewhat, particularly if all you are looking to do is update one specific part of a page, rather than several separate parts at once. In that instance, it might be better to use … wait for it, wait for it … the proprietaryinnerHTML property.
Ye gads! Did we really hear that? Use something that is not part of any recommendation but, rather unfortunately for all of us geeky standardistas, works rather well across all sorts of browsers? At this point, I’d like to repeat another quote from Jeremy:
"If you’re using innerHTML to update content you’re kinda just vomiting the content back on to the page."
Nice.
So, now I have Jeremy’s book to read but should I find any parts getting to complex or too onerous to take in because of all that DOM scripting malarky, I’ll just yak up and move swiftly along!
On a serious note, congrats to Jeremy and the Clear:left chaps on a useful 1-day session. I learnt some new techniques and for my money it made me think more about issues of backwards compatibility (or rather progressive enhancement) when using AJAX, when it is a good or bad idea to use AJAX and techniques for making it obvious to the user that AJAX is at play and that something has changed/is changing on the page. Now I’m really looking forward to seeing what James Craig has to say about accessibility in Web 2.0 apps.
Posted: February 13th, 2006 under Tech, Web Standards.