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

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 UTC