W3C home > Mailing lists > Public > www-style@w3.org > March 2012

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

From: Christopher Jeffrey <chjjeffrey@gmail.com>
Date: Tue, 6 Mar 2012 19:12:52 -0600
Message-ID: <CAMfa5PfPm9cMVGuyj5uKejYv5aBvxDoQBvLCAQyje3AJYeMmhg@mail.gmail.com>
To: www-style@w3.org

I maintain a selector engine written in javascript[1]. I initially
didn't realize how awkward the reference combinator[2] was until I
tried to implement it.

The problem was apparent after I wrote the first implementation: every
combinator represents some kind of positional relationship between two
elements. The reference combinator, on the other hand, does not. An
element that references another could be located anywhere in the tree.
This requires a kind of hacky workaround to implement; a special case,
just for the reference combinator. It's awkward to implement and
awkward to understand. It doesn't really fit the description of a
combinator. The syntax is strange, as well as inconsistent with the
combinators we've known for years, and I'm sure it's confusing even to
long time css users who are seeing it for the first time.

On top of all this, there's the question of how practical and useful
it would be in reality. Would the average css user ever touch this
combinator, aside from the occasional label/input use-case?

I just want to spark some discussion about this.

[1]: https://github.com/chjj/zest
[2]: http://www.w3.org/TR/selectors4/#idref-combinators

Christopher Jeffrey <chjjeffrey@gmail.com>
Received on Wednesday, 7 March 2012 14:21:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:13 UTC