atom feed72 messages in org.w3.public-webapiRe: ACTION-87: Selectors API
FromSent OnAttachments
46 earlier messages
lioreanMay 13, 2006 12:08 pm 
Anne van KesterenMay 13, 2006 12:26 pm 
lioreanMay 13, 2006 2:40 pm 
Anne van KesterenMay 14, 2006 7:20 am 
lioreanMay 14, 2006 4:22 pm 
Anne van KesterenMay 15, 2006 3:15 am 
lioreanMay 16, 2006 9:29 pm 
Anne van KesterenMay 17, 2006 5:18 am 
Lachlan HuntMay 17, 2006 6:19 am 
Anne van KesterenMay 17, 2006 6:30 am 
Jim LeyMay 17, 2006 6:35 am 
Lachlan HuntMay 17, 2006 7:02 am 
Robin BerjonMay 17, 2006 7:07 am 
Anne van KesterenMay 18, 2006 12:46 am 
Jonas SickingMay 30, 2006 3:11 pm 
Jonas SickingMay 30, 2006 3:24 pm 
Jonas SickingMay 30, 2006 3:42 pm 
Ian HicksonMay 30, 2006 3:55 pm 
Robin BerjonMay 30, 2006 4:15 pm 
Jonas SickingMay 30, 2006 5:56 pm 
Anne van KesterenJun 5, 2006 2:46 am 
Anne van KesterenJun 5, 2006 2:49 am 
Jonas SickingJun 5, 2006 12:31 pm 
Charles McCathieNevileJun 5, 2006 5:37 pm 
lioreanJun 5, 2006 6:16 pm 
Maciej StachowiakJun 5, 2006 10:40 pm 
Subject:Re: ACTION-87: Selectors API
From:liorean (
Date:Jun 5, 2006 6:16:54 pm

On Mon, 05 Jun 2006 19:49:36 +1000, Anne van Kesteren <> wrote:

I'm not really fond of matchOne()... Is there any precedence on this?

Not in JavaScript that I can think of. The only precedent case I can think of for this example is String.prototype.match. That function does both though; it's the "global" flag on the regex that determines whether to return just the first match or all of them. And in my mind, that is a design error in regex in JavaScript, since it's entirely plausible to want to use the same regex in both types of matches. This can be done by setting the global flag on the regex and using RegExp.prototype.exec when a single match is desired and String.prototype.match when an array of matches is wanted Just the fact you have to change whether it's the regex or the string that you call a method on - not to speak of the fact you need to set the global flag on all regexes if you want this behaviour uniformly - makes this an ugly solution to my eyes. The responsibility for solving problems like this should lie on the functionality provider, not the functionality consumer.

On 06/06/06, Charles McCathieNevile <> wrote:

There is a precedent for any naming thing you care to consider, and some you would prefer not to.

Indeed... I think my example highlights that.

I am with Jonas on this - I don't think the name hurts or increases confusion and it does slightly decrease it. But picking names is always painful. We'll never get it perfectly right, but we can always get it oh-so-very wrong :(

I tend to agree here. I don't like the suggested design of having selectors be second class though. I think selectors are important enough to have as first class objects, just like regex are. Compile them to an object once, use multiple times. Little is lost in performance for those using them once, but much is gained for those using them over and over. It makes the code for a single use a little more complex, but not that very much. It doesn't make much of a difference in code complexity for those using them multiple times, and might even mean a reduction in code complexity. It does make up the question of whether the methods for matching should be placed on the Selectors objects or the Document/Element nodes though. -- David "liorean" Andersson <uri:>