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

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

On Fri, Jun 28, 2013 at 3:20 PM, Tim Streater <tim at clothears.org.uk> wrote:
>> 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.

Assuming you know literally anything about CSS, yes, it is quite
obvious that that's what you do.  "#foo" is an id selector.

If you don't know anything about CSS, I suggest learning at least the
basics.  Attempting to do JS work without knowledge of CSS's abilities
will lead you to duplicate, badly, functionality already built into


More information about the whatwg mailing list