W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2013

Re: [whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragments

From: Anne van Kesteren <annevk@annevk.nl>
Date: Thu, 5 Sep 2013 11:02:38 +0100
Message-ID: <CADnb78jxE5B2KTYXj0QBv0GSoGddb=Gbxym5Cp5tYxm7zMG1aA@mail.gmail.com>
To: Zirak A <zirak@mail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Fri, Jun 28, 2013 at 9:19 PM, Zirak A <zirak@mail.com> wrote:
> Currently, a DocumentFragment only inherits from Node, and thus loses methods like getElementById. However, the Selector API (http://www.w3.org/TR/selectors-api/) defines querySelector and querySelectorAll on document fragments.
> My proposal is to add getElementById (which makes sense, as the document fragment is a root node), getElementsByTagName (and its namespace-sensitive version), getElementsByClassName and getElementsByName - in short, all of the general selection methods available on the Document.

Per http://dom.spec.whatwg.org/ this is the wrong forum for DOM.

Having said that, our current plan is to rely on the Selectors API (2)
and slowly move away from getElement* friends over time, as their
return values are less than optimal. getElementById is an exception to
this, but the hope is that .querySelector("#test") will be fast
enough. If it turns out to be a problem, we should re-evaluate at that
point. Concrete suggestions for new traversal APIs should be discussed
on www-dom@w3.org or the DOM bug database until we decide the more
appropriate forum is here, it'd be unfair to the existing community

If you think I should reply to any of the remainder of this thread
please let me know, but I hope this general answer is sufficient.

Received on Thursday, 5 September 2013 10:03:12 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC