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 15:53:28 -0700
Message-ID: <CAAWBYDCvSHzvorTRpVHVnJCEQzFx6rcDry5_yQjegu-iK7gWpA@mail.gmail.com>
To: Tim Streater <tim@clothears.org.uk>
Cc: WHATWG <whatwg@lists.whatwg.org>, Zirak A <zirak@mail.com>
On Fri, Jun 28, 2013 at 3:20 PM, Tim Streater <tim@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
CSS.

~TJ
Received on Friday, 28 June 2013 22:54:11 UTC

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