- From: Ryosuke Niwa <rniwa@webkit.org>
- Date: Fri, 29 Jun 2012 11:47:02 -0700
- To: Elliott Sprehn <esprehn@gmail.com>
- Cc: www-dom <www-dom@w3.org>
- Message-ID: <CABNRm61NdnT0XF-vUFawG-RGEBKeFHD-5y55qaRXn=MmzUMA9A@mail.gmail.com>
On Fri, Jun 29, 2012 at 11:22 AM, Elliott Sprehn <esprehn@gmail.com> wrote: > On Fri, Jun 29, 2012 at 11:18 AM, Ryosuke Niwa <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. 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. - Ryosuke
Received on Friday, 29 June 2012 18:47:51 UTC