W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

Re: NodeList (Re: CSS::SAC)

From: Robin Berjon <robin@knowscape.com>
Date: Wed, 21 Mar 2001 15:12:36 +0100
Message-Id: <4.1.20010321145556.03249ed8@mail.knowscape.net>
To: Philippe Le Hegaret <plh@w3.org>
Cc: Bjoern Hoehrmann <derhoermi@gmx.net>, www-dom@w3.org
At 17:02 20/03/2001 -0500, Philippe Le Hegaret wrote:
>Robin Berjon wrote:
>> In the new Perl DOMs, NodeLists aren't objects either, just plain and
>> simple arrayrefs.
>That seems inconsistent with the DOM spec. How does it implement the live
>aspects of NodeLists if it is an array?

As Ken explained earlier today, it's more an addition to the interface than
a reduction of it. Some minimal implementations will choose to make those
simple arrays (and thus drop the liveness) but more complex ones will
provide item() and getLength(), as well as take care of the liveness.

The array interface really makes a lot of things much easier, notably for
implementing queries with filters (ie XPath or CSS selection) over a DOM.
The fact that an array can be implemented just about any way under the hood
(using ties for instance) means that there is no loss of funcitonality if
the implementor choose so.

Similarly, using hashes for NamedNodeMaps with an underlying tie means that
both $nnmap{[%ns_uri, $lname]} and $nnmap{$qname} can work on the same
hash. Or that one can do $text_node =~ s/foo/bar/ to directly modify the
text node's value. It doesn't mean that the DOM methods aren't there, but
those are nice convience additions which one would expect to see in the
Perl world.

As per Bjoern's request, I've been adding Java/spec equivalents to SAC, and
will do the same when I'm done with CSS::DOM.

-- robin b.
Smoking is one of the leading causes of statistics.
Received on Wednesday, 21 March 2001 09:14:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC