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

Tim Streater tim at clothears.org.uk
Fri Jun 28 15:20:00 PDT 2013

On 28 Jun 2013 at 22:28, 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.

Quite so.

> From: Tab Atkins Jr.

> Given that you have querySelector, why would you want the other
> functions? getElementById("foo") is just querySelector("#foo"),
> getElementsByTagName("foo") is just querySelectorAll("foo"), etc.

In addition it's hardly obvious that this is what you do.

Cheers  --  Tim

More information about the whatwg mailing list