Re: [Element Traversal LC] access to element by index

Hi, Jonas-

I addressed Daniel's comments in another email, but I wanted to address 
your additional points specifically.

Jonas Sicking wrote (on 3/28/08 12:23 PM):
> 
> I agree with Daniel here. I'm not really following your argument. Are we 
> trying to keep compatibility with the SVG spec here? Is the interface as 
> designed now 100% compatible with SVG?

SVG dropped Element Traversal from its spec, and gave it to the WebAPI 
WG to spec out, so it only references it, thus there can be no 
incompatibilities per spec.

In pragmatic terms, UAs, libraries, and related JSRs which focus on SVG 
Tiny 1.2 have already adapted to the only change I introduced, 
'childElementCount'.  So, there are no incompatibilities by 
implementation either.  (See my other email for the wisdom of waiting 
for spec stability.)


> If we're not 100% compatible with SVG, why would they oppose an 
> improvement like the suggested one?

Indeed, I did introduce a nodeList in an earlier version of the spec to 
add this functionality, but was convinced to remove it by general 
consensus of this WG and by merits of argument.  There are pros and cons 
to each approach, but within the scope of the larger context of 
available Web APIs, I think the more compelling argument is to leave the 
spec as is.


> If we don't provide a way to grab elements by index I don't really see a 
> purpose of the childElementCount attribute.

The use for 'childElementCount' is laid out in the spec, most explicitly 
in one of the examples [1], and in the introduction:

"The DOM Level 1 Node interface also defines the childNodes attribute, 
which is a live list of all child nodes of the node; the childNodes list 
has a length attribute to expose the total number of child nodes of all 
nodeTypes, useful for preprocessing operations and calculations before, 
or instead of, looping through the child nodes. The ElementTraversal 
interface has a similar attribute, childElementCount, that reports only 
the number of Element nodes, which is often what is desired for such 
operations."

Though the example uses HTML, this is really a more common scenario in 
SVG, where more of the content is element-based, rather than text-based. 
  Speaking as an author of many SVG Webapps and a contributor to several 
SVG script libs, knowing the number of child elements is a really common 
need; index-based access is less needed, and can be effected by other 
means.

[1] http://www.w3.org/TR/ElementTraversal/#example-3.2

Regards-
-Doug Schepers
W3C Team Contact, SVG, CDF, and WebAPI

Received on Friday, 28 March 2008 17:00:45 UTC