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

Re: Support getElementById and other methods of ShadowRoot on DocumentFragment

From: Jonas Sicking <jonas@sicking.cc>
Date: Sat, 30 Jun 2012 03:17:20 +0200
Message-ID: <CA+c2ei_HTGtiGbM-JmciksFb1goPTswfbhEzEnYPOeE5jvFiCw@mail.gmail.com>
To: Elliott Sprehn <esprehn@gmail.com>
Cc: www-dom <www-dom@w3.org>
On Fri, Jun 29, 2012 at 8:03 PM, Elliott Sprehn <esprehn@gmail.com> wrote:
> DocumentFragment has querySelector and friends, but doesn't have
> getElementById or getElementByClass etc. Because of this the methods were
> explicitly added to ShadowRoot which seems kind of silly. There's also
> innerHTML on ShadowRoot but not on DocumentFragment.
>
> https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-object
>
> Could we get these methods added to DocumentFragment instead?
>
>  HTMLElement getElementById(in DOMString elementId);
>  NodeList getElementsByClassName(in DOMString tagName);
>  NodeList getElementsByTagName(in DOMString className);
>  NodeList getElementsByTagNameNS(DOMString namespace, DOMString localName);
>  attribute DOMString innerHTML;

This seems like yet another reason to make the root of the shadow tree
be an element rather than a DocumentFragment. In the component model
spec we're likely going to be creating shadow trees by cloning
<template> elements, so it seems to make a lot of sense to me to use
that cloned <template> element as the shadow tree, rather than
conceptually moving all the children over to this, arguably somewhat
awkward, DocumentFragment subclass.

/ Jonas
Received on Saturday, 30 June 2012 01:18:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 30 June 2012 01:18:23 GMT