Archive for April, 2010

Rethinking DOM Extensions

I was recently asked my opinion about extending the DOM with JavaScript. Most browsers allow access to the prototype on DOM types, like Node and Element. Some of the earliest JavaScript libraries, most famously Prototype.js, took advantage of that fact to add functionality onto the core DOM types.

DOM extension has been a dirty word in the JavaScript community ever since, and even the Prototype.js team has sworn it off for their 2.0 release. (Juriy Zaytsev details the reasons why in his excellent post, “What’s Wrong with Extending the DOM”.)

Not long ago, I’d have agreed wholeheartedly that DOM extension does more harm than good, but a recent mobile project has got me singing a very different tune: DOM extension may well be the future. (more…)