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

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