Re: Publishing Selectors API Level 2 as an FPWD?

On 11/01/10 8:29 AM, Lachlan Hunt wrote:
> Sean Hogan wrote:
>> On 8/01/10 1:19 AM, Lachlan Hunt wrote:
>>> can we publish Selectors API Level 2 as an FPWD?
>>>
>>> http://dev.w3.org/2006/webapi/selectors-api2/
>>
>
>> I can't see the value of queryScopedSelector*() methods. The original
>> rationale was that JS libs could potentially drop their selector
>> engines, but this isn't facilitated by the proposed methods. Given that
>> JS libs will still have to parse the selectors it is a trivial step 
>> to call
>> querySelector*(rewrittenSelector, refNode)
>> rather than
>> queryScopedSelector*(rewrittenSelector)
>
> Personally, I agree and was initially hesitant about adding it, but 
> there were some reasonable arguments put forth suggesting that lifting 
> the burden of pre-processing the selector to prepend :scope from JS 
> libs would be useful [1].  Evidence to the contrary would be helpful.  
> John Resig also once told me he had an alternative proposal, but he 
> hasn't yet shared it with me.
>

That's my point - in its current form queryScopedSelector*() doesn't 
lift that burden of pre-processing.
I don't know about all selector engines, but jQuery, for example, has 
several non-standard selectors that will continue to require 
pre-processing.
:first, :last, :even, :odd, :eq(), :gt(), :lt(), :header, :animated,
:contains(), :has(), :parent,
:input, :text, :password, :radio, :checkbox, :submit, :image, :reset, 
:button, :file

Even if jQuery deprecates non-standard selectors, the current spec for 
queryScopedSelector*() doesn't support the jQuery implicitly "scoped" 
selector "> *".

>> The queryScopedSelector*() methods have misleading names - they don't
>> match the definition of scope.
>> It would be ridiculous to stick with those names if there are no
>> implementations already out there.
>
> Do you have a better alternative suggestion?
>
>> Similarly, the :scope pseudo-class has a misleading name.
>
> I've tried various alternative names, like :context, :reference, etc., 
> but so far scope seems to be the least objectionable.  But all things 
> considered, I don't think :scope is a particularly bad name, since 
> it's name somewhat describes it's purpose and relates it to its 
> utility in scoped stylesheets.
>

:reference matches the text of the spec. :context would be second choice 
I guess.
I seem to recall :ref-node and :context-node also being suggested.
:scope only describes its purpose in specific cases - queries with one 
of the following forms:

element.queryScopedSelector(":scope *")
element.queryScopedSelector(":scope > *")

In the following forms :scope is misleading:

element.queryScopedSelector(":scope + *")
element.queryScopedSelector(":scope ~ *")

and especially:

element.querySelector("* :scope *", refNode)

Received on Monday, 11 January 2010 04:58:54 UTC