W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2013

Re: [whatwg] Proposal: q and qq for document.querySelector and document.querySelectorAll

From: Niels Keurentjes <niels.keurentjes@omines.com>
Date: Wed, 18 Sep 2013 12:18:20 +0000
CC: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
Message-ID: <A212DA0831E8714BB0860F102E8E29DC856D350D@omines-srv-004.omines.corp>
The spec should only concern itself with exposing functionality. Practical considerations such as length of code are the responsibility of the developer - if you like to have q and qq aliases you can add them yourself at runtime, that's the whole point of a prototyped language. Common libraries like jQuery, prototype and Mootools expose the behaviour as $ and $$ for exactly the reason given, no reason to impose that on every developer if they choose not to use a library.

-----Original Message-----
From: whatwg-bounces@lists.whatwg.org [mailto:whatwg-bounces@lists.whatwg.org] On Behalf Of Scott González
Sent: woensdag 18 september 2013 14:11
To: Leon Gilyadov
Cc: whatwg@lists.whatwg.org
Subject: Re: [whatwg] Proposal: q and qq for document.querySelector and document.querySelectorAll

So you're suggesting new globals that are bound to the document? That sounds really bad. Also, there's no reason to suggest an alias to
querySelector() when it's much more likely that query() will be used by the majority of developers.

On Wed, Sep 18, 2013 at 4:14 AM, Leon Gilyadov <leon.gilyadov@gmail.com>wrote:

> *The problem:*
> document.querySelector and document.querySelectorAll are long and used 
> a lot.
> Lines in the code are long.
> *Proposal:*
> q('.my-div')
> will be equal to:
> document.querySelector('.my-div)
> qq('.my-div')
> will be equal to:
> document.querySelectorAll('.my-div')
> --Leon Gilyadov.
Received on Wednesday, 18 September 2013 12:18:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC