On Wed, 17 May 2006 15:19:46 +0200, Lachlan Hunt <[EMAIL PROTECTED]> wrote:
I like match() too because it's much shorter than getElementsBySelector(),

Right... :-)


but I think the fact that it only returns a single node is confusing and that, in most cases, authors would want the whole collection, not just the first match. I think it would be better if the methods were:

[...]

In that case you have this issue:

* match("foo")[0] (when match() would return a list)
* matchOne("foo")
* matchFirst("foo")

The shortest name should represent the most efficient method imho.


What's wrong with using:

var selectorMatches = document.matchAll('#bleh elm3', resolver);

There may still be use cases for matching a sub tree, so it may be worth extending the Element interface too, but all the ones I can think of can be handled by simply writing a more specific selector.

Yeah, except when you get a random element back like event.target. And even in that case you can probably give the event some random ID in most cases but it's not really flexible.


--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>


Reply via email to