W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

[DOM4] Question about using sequence<T> v.s., NodeList for (was [DOM4] NodeList should be deprecated )

From: Vincent Hardy <vhardy@adobe.com>
Date: Thu, 15 Mar 2012 17:59:48 -0700
To: "public-webapps@w3.org" <public-webapps@w3.org>
Message-ID: <CB87D9A6.37E6B%vhardy@adobe.com>

I am working on a proposal (http://wiki.csswg.org/spec/css3-regions/css-om) to update the CSS Regions CSS OM APIs, and one of the changes is to make various lists static. I see that the thread at http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/1068.html stemmed from the CSS Regions OM implementation in WebKit.

It seems that the thread resulted in an agreement to keep using NodeList and make it inherit from Array. I also see that change in the latest editor draft of DOM4.

For the changes we are proposing, we have a need to return a static array of Nodes. We can follow the pattern discussed in this thread and use NodeList, but we also need to return arrays of Range instances (static list) and arrays of Region objects (static list).

I am wondering if it would be better to define a RegionList class and a RangeList class, to be consistent with NodeList, or would it be better to use sequence<Region> and sequence<Range>?

I think we have three options:

a. Use sequence<T> everywhere we have static lists in the CSS regions APIs. This is consistent within the spec., but would be inconsistent with DOM4 NodeList and its usage.

b. Use sequence<T> everywhere except where T=Node, in which case we would use NodeList. This is consistent with DOM4 and inconsistent within the spec.

c. Use NodeList and define RegionList/RangeList. This is consistent in the region spec. and with DOM4. But it introduces new interfaces with little added functionality (and they would have to be kept in sync. with NodeList if new features were added to the interface).

All in all, I think I prefer option b. but I would appreciate feedback.

Received on Friday, 16 March 2012 01:00:16 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:38 UTC