Re: [selectors4] Should the reference combinator really be a combinator?

On Thu, Mar 8, 2012 at 3:34 PM, L. David Baron <dbaron@dbaron.org> wrote:
> On Wednesday 2012-03-07 14:57 -0800, fantasai wrote:
>> On 03/07/2012 01:29 PM, Tab Atkins Jr. wrote:
>> >
>> >There are some other relationships that we could potentially express
>> >as combinators but have instead chosen to represent as pseudoclasses,
>> >such as :col(), but that's because the relationship there is very
>> >specific to HTML (and other languages that have tables which are
>> >represented in row-major form, plus childless column elements) and not
>> >general-purpose.  The reference combinator is potentially
>> >multi-purpose.
>>
>> Actually that's an interesting point. Hixie's original proposal for
>> :column() used // as a combinator instead. Using a combinator there
>> does avoid the branching possibilities present with :column(), and
>> might therefore make more sense. What do you think?
>
> So far, the reference combinator syntax in selectors4 doesn't make
> much sense to me.  I prefer :column() as it is, and would rather see
> the reference combinator use a functional pseudo-class (if we have
> it at all).  (That said, as a pseudo-class it's clearer that it's
> the backwards-reference pseudo class... which makes it clear how odd
> a construct it is.)

It's only a backwards reference because you specifically inverted the
relationship by turning it from a combinator to a pseudoclass.  As a
combinator, it's a forward reference.

An additional benefit of using a combinator is the combination with
the theoretical subject indicator, so that you *can* traverse the
relationship backwards.


> (Also, if we're inventing reference and backward-reference selectors
> for IDREFs in the markup, what happens when markup starts using
> selectors?  Will we want reference and backward-reference selectors
> to match a selector in the markup?)

I see no reason why this combinator wouldn't work for attributes using
selectors as well.  Hmm, though - I suppose at that point the
implementation needs to be aware of the attribute, which makes it less
useful for arbitrary XML languages.

~TJ

Received on Friday, 9 March 2012 15:43:43 UTC