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 17:37:06 -0700
Message-ID: <CAAWBYDC=_oePD5Wfe7BMvy7tvLe+_JPnkgK3F9H66SReaGkzTw@mail.gmail.com>
To: Zirak A <zirak@mail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Fri, Jun 28, 2013 at 5:32 PM, Zirak A <zirak@mail.com> wrote:
> But that's a bit looking at it backwards. Selectors are supposed to be an
> abstraction over these methods, not the other way around. The point here is that
> document fragments are documents - so they should have a consistent API.
> Adding this isn't about "backwards compatibility" or anything of the sort. It's
> adding methods that people already use, because as said, not everyone uses
> selectors (and not just because of browser-compat).

No, they're not.  You're rewriting history.  Selectors were never
meant as a layer over those methods; they were a completely separate
and independently-invented way to target elements for CSS's purposes.
I'm not sure of the precise dates, but I know that Selectors precede
at least some of those properties, maybe all.

Selectors are a better way to query documents, and they're extremely
well-known.  All of the old DOM query methods translate directly into
simple selectors - qS("#foo"), qSA(".foo"), qSA("foo"), or
qSA("[name=foo]").

~TJ
Received on Saturday, 29 June 2013 00:37:50 UTC

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