Re: DOM based API

On Fri, Jun 6, 2008 at 12:16 PM, Anne van Kesteren <annevk@opera.com> wrote:
> On Fri, 06 Jun 2008 16:55:09 +0200, Mark Baker <distobj@acm.org> wrote:
>>
>> I'm very glad to see somebody mention using the DOM API for this kind
>> of information, right off the bat.  I'm a big believer in reuse, and
>> feel that this API is an obvious candidate for reusing the DOM, i.e.
>> providing a "Location" Javascript object that's also a DOM Document.
>
> Why would it be a Document?

There might be value in making it a Node in another document (or a
DocumentFragment), sure.  But if you mean why reuse the DOM at all,
I've actually got a blog post waiting in the wings on that subject,
but the gist of the value is that rather than requiring developers
learn new interfaces specific to some task, to reuse a generic
interface like the DOM where possible, reducing the learning curve and
enabling the serendipitous reuse of on-device data (more on that at a
later time).

Consider the example of a script wanting to register for an event when
the device leaves a predefined location.  One can obviously write a
custom access (e.g. the current Gears proposal) & eventing API for
that, or one can just make all that information available as a
Document and then register for a mutation event when the value of the
"currentLocation" element of that document changes.

Mark.

Received on Friday, 6 June 2008 16:47:16 UTC