W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2006

[whatwg] Intergrating the DOM and JavaScript (JSDOM)

From: Dean Edwards <dean@edwards.name>
Date: Thu, 11 May 2006 00:38:05 +0100
Message-ID: <4462795D.8050401@edwards.name>

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
Received on Wednesday, 10 May 2006 16:38:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:27 UTC