From: Boris Zbarsky [mailto:bzbar...@mit.edu] 

> 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.

That sounds cool too! I was just concerned it wouldn't be optimizable enough.

>> 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!

I just assumed that allowing implementations to optimize by directly reaching 
into selector caches etc. would be better. But you're the implementer! :) If 
internal properties are less optimizable than working in terms of 
querySelector, I'm fine either way!

Reply via email to