Re: NodeList (Re: CSS::SAC)

Philippe Le Hegaret <plh@w3.org> writes:

> (moved from www-style@w3.org to www-dom@w3.org)
> 
> Robin Berjon wrote:
> > 
> > At 05:51 04/03/2001 +0100, Bjoern Hoehrmann wrote:
> > >| There is no SelectorList class (for now at
> > >| least). SelectorLists are passed as simple Perl array
> > >| refs. Likewise for the SACMediaList. This may change at some
> > >| point if I realize that there is value in making those into
> > >| objects, but for now it seems useless. If I change it, they
> > >| will still be accessible as array refs.
> > >
> > >It would be consistent with the DOM if those lists are objects
> > >with item() and getLength() methods.
> > 
> > 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?

For a fully conformant DOM "lite", is because it doesn't use a "plain"
Perl array but instead uses a tied array as an interface to a
conformant implementation.

Having said that, and like the Python folks' Minidom, the general
populace seems to prefer a "faster" non-conformant implementation over
a fully conformant one.

For reference, I posted a draft of the proposed Perl DOM "lite" to the
perl-xml list and have a copy here:
  <http://Casbah.org/~kmacleod/orchard/perlish-dom-draft>
Note that this draft does not cover every information item right now,
but the pattern should be apparent.

In summary, Perl DOM lite differs from DOM in these ways:

  * does not have navigation or node manipulation methods (depends on
    Perl-style navigation and manipulation)
  
  * NodeList and NamedNodeMap are replaced by native Perl array and
    hash syntax (note: does not imply native implementation in
    conforming implementations)
  
  * uses a (URI,LocalName) pair to the non-NS methods in places where
    *NS() methods would be used
  
  * uses hash syntax for Element.Attributes (also supporting
    (URI,LocalName) indexes)

  * uses native String syntax (noting !~ implementation again)

  * node types are symbols, not constants (tentatively)

  * exceptions have yet to be mapped to Perl exceptions, so no further
    detail is available yet

In all respects, a conforming Perl DOM lite implementation, via an OMG
IDL wrapper, should be a conforming DOM implementation.  Mostly it's a
difference in presentation.

  -- Ken

Received on Tuesday, 20 March 2001 20:14:18 UTC