W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2009

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

From: Simon Pieters <simonp@opera.com>
Date: Mon, 19 Oct 2009 07:25:04 +0200
To: "Doug Schepers" <schepers@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.u107z2mfidj3kv@simon-pieterss-macbook.local>
On Mon, 19 Oct 2009 06:56:45 +0200, Doug Schepers <schepers@w3.org> wrote:

> 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.

That does not matter.

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/281

WebKit, Opera and Firefox include the svg element in the collection.

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/282

Opera and Firefox has .children on non-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).

I don't understand why we should have both .children and .childElements.  
Isn't one attribute enough?


> 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).

Certainly.


> 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

Cheers,
-- 
Simon Pieters
Opera Software
Received on Monday, 19 October 2009 05:25:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT