DOM4 Core (was: childElements, childElementCount, and children)

Hi, Folks-

John Resig wrote (on 10/18/09 1:50 PM):
>>  They already do. Which casts some amount of doubt on Maciejs argument
>>  that it was too performance heavy to implement in WebKit. :)

Well, it does work in HTML, but not in SVG [1]... which may or may not 
be desirable, since .children returns an HTMLCollection, and SVG 
elements are not HTML elements.


>>  p.s. It also works in Opera and IE.

Sure, but I mentioned that already. :)  (Note to self... write pithier 
emails.)


> Yeah, .children is already the de facto standard here - implemented in
> every major browser. It's a real shame that it hasn't (and won't?)
> make it in to a spec, especially considering that it's already
> implemented everywhere.

Nothing to stop it from being specified, but I doubt that Internet 
Explorer will change its behavior, since that will likely break existing 
Web content (IE team, thoughts?).  I generally agree with Garrett here, 
so I've followed up on my early promise to specify this by starting the 
DOM4 Core spec [2], and included 'children' as an HTMLCollection (to 
satisfy the case that John rightly describes), and 'childElements' as a 
new ElementCollection (to supply a more progressive interface that 
authors can rely on predictably).

The WebApps WG is explicitly chartered [3] to produce the DOM4 Core 
spec, along with a new version of Element Traversal:
[[
  Element Traversal 2.0
     an extension of Element Traversal 1.0 to provide a nodelist interface
]]

However, I think it makes more sense at this point to simply include 
these new attributes in DOM4 Core, along with the indispensable bits of 
Element Traversal (that is, everything except the childElementCount, 
which is superfluous to childElements.length).  I'd like this to also 
contain the work that Simon Pieters did on Web DOM Core [4], if he's 
willing to have that folded in (I left it out pending word from him... 
he's BCCed on this message).

I'm happy to help editing this document, but I would be even happier if 
someone else would also step up to serve as co-editor.


[1] 
http://www.schepers.cc/w3c/webapps/elementtraversal/tests/et-children.svg (cf. 
.html and .xhtml)
[2] http://dev.w3.org/2006/webapi/DOM4Core/DOM4Core.html
[3] http://www.w3.org/2008/webapps/charter/
[4] http://simon.html5.org/specs/web-dom-core

Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs

Received on Monday, 19 October 2009 04:56:49 UTC