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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 28 Jun 2013 16:52:20 -0700
Message-ID: <CAAWBYDAOphCBEtX4=shcUccUZDYD8b9zXbzPziPa=sCbqLkHtQ@mail.gmail.com>
To: Zirak A <zirak@mail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Fri, Jun 28, 2013 at 4:45 PM, Zirak A <zirak@mail.com> wrote:
> My intention wasn't for this to be an argument whether the selectors API make
> anything before them obsolete. The intention was to make the API more
> consistent - if documents have a getElementById method, so should document
> fragments.
> I acknowledge that selectors let you write more complex queries, and that some
> developers prefer them. However, others (like me) prefer using the "older"
> methods like getElementById. As said, this is an attempt to make the API more
> consistent, given that we already have methods like getElementById.

While consistency with the past is good, it shouldn't be fetishized.
Adding methods means more code in the browsers, which is a non-zero
cost.  When the requested feature is literally 100% obsoleted by
another feature that already exists, there's really no reason to add
the requested feature.

Note that you can add these yourself, if desired, by adding methods to
the DocumentFragment prototype that are defined in terms of
querySelector.

~TJ
Received on Friday, 28 June 2013 23:53:04 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:22 UTC