Your leaking thatched hut during the restoration of a pre-Enlightenment state.

 

Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").



links

decay & ruin
Biosphere II
Chernobyl
dead malls
Detroit
Irving housing

got that wrong
Paleofuture.com

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff


Like asecular.com
(nobody does!)

Like my brownhouse:
   DOM dumping
Saturday, July 28 2007

I spent most of the day working on my calendar and questionnaire code (these two applications share a large common code base of PHP and Javascript). Most of this time was spent tracking down and eliminating bugs that had accumulated in the complexity as a consequence of added features, functionality modifications, and yes, other bug fixes. It's easy to add a feature, do a cursory test, and think the addition resulted in no unforseen side effects. But in code this complicated and generic, it's easy for a small bug to remain hidden for weeks even as it poisons the entire behavior of the system. Yet, because the code is so generic, once I get the bugs worked out for a particular arrangement of data, I find that the functionality and reliability are available across a wide range of circumstances, many of which are already in use.
This sort of programming pushes hard up against the bugs in the underlying architecture, particularly the bugs present in the Javascript implementations of both Internet Explorer and Firefox. I've complained in the past about Internet Explorer's name/id bug, but Firefox also contains bugs, one of which caused me much frustration today. It turns out that if you create a <span/> tag in front of another tag (let's say <other node/>) the Document-Object Model (DOM) recognizes the <span/> tag not as an isolated <span/>, but instead as <span><other node/></span>. This has dire effects as you try to walk the DOM tree, since now all of a sudden the DOM node you thought was at one level is actually another level down. Node scanners expecting it to be at the higher level will never find it, and you'll find all sorts of nutty and hard-to-diagnose behavior in DHTML magic. If I didn't have a DOM-dumping tool I wouldn't be able to do this work. Luckily I do, one I wrote myself a little over a year ago. It looks like this:

function domdumpwindow()
{

tagarray=document.getElementsByTagName("body");
whatwewanttosee=tagarray[0];
dump = window.open("","_new","menubar=yes,height=800,width=800,scrollbars=yes");
dump.document.write("<plaintext>" + whatwewanttosee.innerHTML);
}

To call it all you need is this:

<a href="javascript:domdumpwindow()">dump the DOM</a>


For linking purposes this article's URL is:
http://asecular.com/blog.php?070728

feedback
previous | next