[whatwg] Intergrating the DOM and JavaScript (JSDOM)
Dean Edwards
dean at edwards.name
Wed May 10 16:38:05 PDT 2006
At the moment, DOM objects are specified in a language neutral way.
That's fine. However, this makes these objects uninteresting and
cumbersome to script with.
Mozilla has a more integrated programming environment. It exposes DOM
objects as native JavaScript objects. That means I can do things this
like this:
Object.prototype.foo = "bar";
alert(document.body.foo);
==> "bar"
A trivial example but it demonstrates that the DOM and JavaScript are
not totally separate on a Mozilla platform. This is very cool. 8-)
It would be great if NodeLists were subclasses of JavaScript Array
objects (especially with the introduction of Mozilla's Array Extras
[1]). This makes iteration over DOM queries more flexible.
I guess what I'm proposing is a new DOM API. One which is specified with
JavaScript in mind. A redefinition of DOM objects as subclasses of
JavaScript objects. Mozilla already does this by and large. It makes
that browser a dream to program with.
Is this within the remit of the Web Apps spec? This seems like a
fundamental change in terms of browser architecture so I would
understand if it was too difficult to implement in the short term.
But it would be cool.
-dean
[1] http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6#Array_extras
More information about the whatwg
mailing list