W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: [selectors-api] Consider backporting find() behavior to querySelector()

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Wed, 20 Jun 2012 02:00:23 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: Simon Pieters <simonp@opera.com>,"Kang-Hao (Kenny) Lu" <kennyluck@csail.mit.edu>,public-webapps.w3.org <public-webapps@w3.org>
Message-Id: <152291340143223@web2d.yandex.ru>
20.06.2012, 00:38, "Tab Atkins Jr." <jackalmage@gmail.com>:
> On Mon, Jun 18, 2012 at 10:59 PM, Simon Pieters <simonp@opera.com> wrote:
>
>> On Mon, 18 Jun 2012 16:57:17 +0200, Kang-Hao (Kenny) Lu
>> <kennyluck@csail.mit.edu> wrote:
>> We have lots of shipped APIs with worse names. I think we should live with
>> past mistakes, try not to make them again, and move on.
>
> This is not a good argument. qSA is used often enough, and has a long
> enough name, that the name is actually a pretty significant
> misfeature. This is a pretty core API, and both it and its precursors
> (getElementByID, etc.) are very commonly renamed by libraries
> precisely because you need a very short name for such a commonly used
> function.

There is a key difference between native functionality and one implemented as a library -- they quite differently relate to backward compatibility. A library can be rewritten partially or even entirely if needed (older applications can just continue using older versions of the library), while native functionality, once widely implemented, have to be supported forever and in fact cannot (and should never) be dropped. 

As for `querySelector()` in particular, its name is indeed not the best, but _not_ because it's too long, but because it's not quite _clear_ / _self-documenting_. `querySelector()` and `querySelectorAll()` should have been named `getElementBySelector()` and `getElementsBySelector()` instead.

In this regard, `find()` is far less clear (and even confusing) as for what it does.
Received on Tuesday, 19 June 2012 22:00:55 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:52 GMT