W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2012

Re: Support getElementById and other methods of ShadowRoot on DocumentFragment

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Sat, 30 Jun 2012 00:13:44 +0300
Message-ID: <4FEE1A88.5050905@helsinki.fi>
To: Ryosuke Niwa <rniwa@webkit.org>
CC: Elliott Sprehn <esprehn@gmail.com>, www-dom <www-dom@w3.org>
On 06/29/2012 09:47 PM, Ryosuke Niwa wrote:
> On Fri, Jun 29, 2012 at 11:22 AM, Elliott Sprehn <esprehn@gmail.com <mailto:esprehn@gmail.com>> wrote:
>     On Fri, Jun 29, 2012 at 11:18 AM, Ryosuke Niwa <rniwa@webkit.org <mailto:rniwa@webkit.org>> wrote:
>         Are you suggesting that getElementsBy* on ShadowRoot will return a static node list? If so, that's inconsistent with the existing ones. If
>         not, then getElementsBy* return HTMLCollection, and I'm strongly opposed to adding any new method that returns live node list or
>         HTMLCollection. They impose significant performance burdens and design constraints on all DOM mutations
>     That's not what the spec says:
>         *Must* behave exactly like document.getElementsByTagName <http://www.w3.org/TR/domcore/#dom-document-getelementsbytagname>, except scoped
>         <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-scoping-constraints> to the shadow DOM subtree.
>     So it should already return a non-static NodeList. It doesn't make sense to have methods with the exact same names and different behaviors on
>     Document vs ShadowRoot.
> Then I'm opposed to adding this on DocumentFragment. Like mutation events, live node lists and HTMLCollection are two of the worst APIs.
Don't compare mutation events and live node lists please ;)

I don't know what is so bad with live node lists (well, making the implementation fast can be a bit tricky).

> We've got rid
> of mutation events in shadow DOM in the favor of mutation observers. We should do the same so that we don't expose any live node lists or
> HTMLCollection inside the shadow DOM. Over time, authors will learn to use methods that return static node lists.

AFAIK, we're not going to remove live node lists from normal DOM, so methods which return live node lists in normal DOM,
should return similar thing also on shadow DOM.


> - Ryosuke
Received on Friday, 29 June 2012 21:14:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:00 UTC