Thursday, October 29, 2009

TreeWalker: The ultimate DOM traversal provider

The W3C's DOM Level 2 calls for the existence of a JavaScript class by the name of TreeWalker, which all DOM Level 2-compliant browsers (amongst the modern ones, this is all but the IE browsers) have successfully provided. But wouldn't it be nice to have a TreeWalker available in IE too? This is the question that was raised at work during a story with very intense JavaScript requirements. And so, I set out to build a cross-browser TreeWalker (obviously leveraging the native TreeWalker when available). I blew through a number of methods easily (parentNode(), firstChild(), lastChild(), previousSibling(), nextSibling()), but had to call it quits for the night when I got to previousNode() and nextNode()... much too complicated to think about at the late hour. I did get some confirmation by looking at Mozile's (Mozilla In-Line Editor) TreeWalker JS (

Looks like they also have some JS files in the same folder ( and to give IE ranges/selections the capabilities of a W3C Range and the Mozilla Selection object, respectively, that I may have to peek at to see if I can refactor any of the RangeInformation class I put together to wrap ranges in a mostly cross-browser fashion.

Along with the Selection library I've recently created, I'd love to publish a copy of the TreeWalker to the open source world. We'll see....

Upon second inspection the next day, it turned out that parentNode, firstChild, lastChild, nextSibling, previousSibling were all actually harder methods than I had given them credit for, and nextNode and previousNode were actually the easy ones. The complications come from the whole "logical view" as defined in the W3C spec for DOM Traversal (DOM level 2) that features the TreeWalker.

Thursday, October 22, 2009

Twin Cities Code Camp 7 this weekend!

This weekend marks the 7th bi-annual (twice annually) Twin Cities Code Camp.  Unfortunately, I have class for the Masters degree all day Saturday.  Fortunately, my classes and TCCC are both at the University of Minnesota's EE/CSci Building.  Therefore, I will be skipping my morning class to attend two sessions on JavaScript but attending my afternoon class as normal.  At least the morning will be more fun than usual.... :)

Sadly, this is the first time TCCC will not be providing lunch to attendees.  While I can understand this predicament given the down economy and relatedly poor sponsorship this time around, it still sucks.  :(

Friday, October 2, 2009

My return to ActiveX

Given the good state of all things JavaScript that I've been working on, I started back in on the ActiveX control I had been working on earlier this summer.  I have already updated the few externally related field values that have changed in the time the project has been idle, but now must work on figuring out why some IE8 users have issues with running it.  Harrumph, not looking forward to it... especially without the free access to the "Add-in Express 2009 for Internet Explorer and Microsoft .NET for Visual Studio 2008 (C#)" that I so desired.  :(