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

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