- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 12 Sep 2013 12:54:12 -0400
- To: Domenic Denicola <domenic@domenicdenicola.com>
- CC: "public-webapps@w3.org" <public-webapps@w3.org>
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