Re: Proposal: getElementsBySelector()

Then a entire document for specifying a single method seems awkward :p
For me, having a method to return only one element seems almost useless,  
so I'd suggest to have another method in the Element interface to say if  
it matches a single selector, as previous mentioned in this mailling list,  
so the document can have a little more "substance". matchesSelector()  
seems a nice name.


Anne van Kesteren <annevk@opera.com> escreveu:

>
> Given the input from Björn I suppose there's no real need for a method  
> that returns a single element node (assuming implementations make that  
> optimization). Given that, I propose we rename .getAll() to  
> .getElementsBySelector() and drop .get() (on both Document and Element).
>
> One advantage is that it's consistent with the naming people already use  
> for custom written functions that have this functionality. In theory  
> it's also not harder to type than .getElementsByTagName(). The only  
> thing that makes it differ from the other getElementsBy* method(s) is  
> that it doesn't return a live NodeList. I don't see that as a major  
> problem.
>
> If there are no strong objections I'll implement this in the  
> specification.
>
>

Received on Sunday, 28 January 2007 21:18:49 UTC