My wife bought Lynne Truss's Eats, Shoots & Leaves for Christmass - what a mistake! turns out, her tendency to delete commas is wronger than my tendency to put them in. Worse, at least for her, there's an IT angle allowing me to poke fun at her in this blog.
I've recently had the unhappy experience of writing this bit of javascript for an onChange() function:
function opensr() {
var npage= 'main_url' + token='+ self.document.leftform.usrid.value;
parent.frames.right.document.location.href=npage;
self.document.leftform.usridb.value=npage;
}
An incredibly clumsy construction that works for Mozilla and Firefox but fails, of course, when used with onChange() in IE.
I should have gone with getElementById() and the rest of that DOM set, thereby expressing, if not agreement with, at least complacency toward, the much decreed constructive agglomeration of Ms Truss's penultimate chapter (take that! Kerry-Anne).
In reality, however, I see this kind of construction as an example of the pernicious influence of BASIC in all its uninformed and generally pig ignorant glory - - and I'm just not going to write anything that looks like loadRightTokenTriggerByCount() where "opensr() will do. Period. Full stop.
To a large extent what seems to be going on here is that the people behind the language change this reflects are all speed typists playing at using the object model without really understanding either its underlying purpose or what the consequent naming structure is fundamentally about.
Look at Microsoft's DOM on their terms and it looks simple enough to be effective: just initialize according to the window.document.element heirarchy and everything will work whether you subsequently add elements or not. Thus:
parent.frames.right.handle.appendChild(window.document.createElement("DIV"));
sure looks cool - but collapes of its own weight when
you find yourself writing:
IfAspectPostiveCallUnitTokenElseDoReplay(listChildNodes(),addChild());
with fun references like parent.frames['rightiframe[3]'].window.document.hackform.byteme.value.
And what would be wrong with treating the page as an element array and writing: D[right;tokens;1] <- 1; instead? It ain't BASIC, that's what.
The last word, however, should go to Ms Truss:
As I mentioned in this book's introduction, by tragic historical coincidence a period of abysmal under-educating in literacy has coincided with this unexpected explosion of global self publishing. Thus people who don't know their apostrophe from their elbow are positively invited to disseminate their writings to anyone on the planet stupid enough to double click and scroll.
That doesn't apply to you and me, of course - but the book is well worth reading and the application to Microsoft's absurd object representation in the naming conventions it grew by merging BASIC with a less than basic understanding of the object paradigm something those of us susceptible to typing errors should probably be more vocal about.