Re: [selectors4] Proposal for extending Selectors Level 4 with possibility to select attributes

Le 05/11/2013 16:42, Tab Atkins Jr. a écrit :
> On Tue, Nov 5, 2013 at 8:24 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
>> Selecting attributes for a style rule in a CSS stylesheet doesn’t make
>> sense. So I assume that this new feature would not exist there, only ITS and
>> possibly Selectors API.
>>
>> This means that it’s probably not a problem to use the @name syntax, as
>> ambiguity with at-rules only exist in CSS stylesheets.
>
> I'm uncomfortable with any assertions that inconsistency with CSS
> stylesheets is okay. Tech has a way of growing together over time.
>
> That said, at-keyword tokens inside of selectors are no problem for
> CSS syntax, as long as they're not the first token (as it'll then look
> like an at-rule).

Right. Though *|*@name is not exactly pretty.


>> That said, I agree with Tab that a syntax pseudo-element like ::attr(name)
>> is more consistent with the rest of Selectors.
>>
>> Regardless of syntax, this would have restrictions similar to
>> pseudo-elements: the attribute part must be at the end of a selector.
>
> Remember that that restriction isn't actually part of the syntax any
> longer (or rather, we agreed to remove it from the syntax).  It's just
> that several pseudo-elements don't have any children or siblings, so
> by definition anything following them will cause the match to fail.

That’s not what I read in the spec:
http://dev.w3.org/csswg/selectors4/#pseudo-elements

"Must", as I understand it, means that selectors that do otherwise are 
invalid rather than merely not matching anything. (BTW I found this hard 
to follow.)

The change from Level 3 is that pseudo-elements may be followed by "user 
action pseudo-classes".


>> (Also, we’ll need terminology to differentiate this for the existing
>> "attribute selectors", which filter elements based on their attributes.)
>
> Attribute pseudo-elements, which select attribute nodes.

Works for me.

-- 
Simon Sapin

Received on Tuesday, 5 November 2013 17:13:11 UTC