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

Tab Atkins Jr. jackalmage at gmail.com
Fri Jun 28 15:51:47 PDT 2013

On Fri, Jun 28, 2013 at 2:28 PM, Zirak A <zirak at mail.com> wrote:
> Because they may result in the same thing, but they have different semantic
> meanings. I want to get an element by its id, not run a CSS selector. I want
> to get elements by their tag names, not run a CSS selector.

There's no semantic difference between the methods.  querySelector is
simply a more powerful querying function than the old DOM methods,
capable of doing everything the old methods did and much more.

> Besides my personal aversion towards selectors being in the DOM API, there's
> also the simple fact that it makes sense for document fragments to have these
> methods.

That's far from obvious, given that I don't think it makes sense to
spread those obsolete methods around any further.


More information about the whatwg mailing list