Re: Selectors: name find method and find signature

On 9/12/13 12:38 PM, Domenic Denicola wrote:
> One idea we had for this was as outlined in the gist at [1], where they try to call some internal "[[QuerySelectorAll]]"-like method of things contained within it

Why is that needed?  If we just want this to be generic and all, it 
seems simplest to say that they just get the "length" of "this", then 
run a counter from 0 to length, for each value [[Get]] that property, 
then [[Invoke]] "querySelectorAll" on it.  This doesn't require making 
up internal methods and works fine as long as people aren't purposefully 
trying to subvert it.

As in, it's basically syntactic sugar for enumerating the list yourself.

Or is the problem that there is no script-exposed version of the thing 
you want query/queryAll to call?  If so, why not?

> I doubt implementing `query` in terms of `querySelectorAll` is actually the best approach though

Why not?

> maybe checking for some internally-set property like [[Queryable]] or [[CanBeReferenceElementForRelativeSelector]] would be better.

I would caution against creating too many internally-set properties. 
They have real implementation costs, especially if you want them on a 
per-element basis!

-Boris

Received on Thursday, 12 September 2013 16:54:42 UTC