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

Re: childElements, childElementCount, and children (was: [ElementTraversal]: Feature string for DOMImplementation.hasFeature(feature, version)?)

From: Brian Kardell <bkardell@gmail.com>
Date: Tue, 20 Oct 2009 20:03:42 -0700
Message-ID: <8fcaeb2c0910202003n2173e4eh2cdd9fc2f6a54dd4@mail.gmail.com>
To: Maciej Stachowiak <mjs@apple.com>
Cc: Jonas Sicking <jonas@sicking.cc>, Doug Schepers <schepers@w3.org>, WebApps WG <public-webapps@w3.org>, "www-dom@w3.org list" <www-dom@w3.org>
> In this particular case, I think anything that's implemented in all of the
> major browser engines should be an official standard, not just de facto.

Why only in this particular case? :)  As a rule that seems like sound
guidance.  If it's implemented everywhere, shouldn't you have to make
a pretty compelling case for it _not_ to be included in an official
standard?



On Tue, Oct 20, 2009 at 1:42 PM, Maciej Stachowiak <mjs@apple.com> wrote:
>
> On Oct 18, 2009, at 4:14 AM, Jonas Sicking wrote:
>
> On Sun, Oct 18, 2009 at 12:12 AM, Doug Schepers <schepers@w3.org> wrote:
>
> So, rather than dwell on an admittedly imperfect spec, I personally suggest
>
> that we urge WebKit developers to implement .children and .children.length,
>
> in the anticipation that this will be in a future spec but can be useful to
>
> authors today.
>
> They already do. Which casts some amount of doubt on Maciejs argument
> that it was too performance heavy to implement in WebKit. :)
>
> What I said way back in the day (about childElements) was this:
>
> "I suggest leaving this out, because it's not possible to implement
> both next/previous and indexed access in a way that is efficient for
> all cases (it's possible to make it fast for most cases but pretty
> challenging to make it efficient for all). This is especially bad
> with a live list and an element whose contents may be changing while
> you are iterating.
>
> If all you care about is looping through once, writing the loop with
> nextElementSibling is not significantly harder than indexing a list."
>
> I stand by that remark. It is indeed hard to get both indexed and
> previous/next access efficient in all cases. Of course, we are not going to
> let that stop us from interoperating with de facto standards, and we do our
> best (as for other kinds of NodeLists and HTMLCollections), but I'd rather
> not have new APIs follow this pattern.
> In this particular case, I think anything that's implemented in all of the
> major browser engines should be an official standard, not just de facto.
> Regards,
> Maciej
>
Received on Wednesday, 21 October 2009 12:21:30 GMT

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