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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 12 Mar 2012 17:41:43 -0700
Message-ID: <CAAWBYDDHGAV0RO=6UyOYC666zzj=+KK9ZEJM2v91-ZRV6Y-DkQ@mail.gmail.com>
To: Christoph Päper <christoph.paeper@crissov.de>
Cc: "www-style@w3.org CSS" <www-style@w3.org>
On Mar 12, 2012 5:13 PM, "Christoph Päper" <christoph.paeper@crissov.de>
wrote:
>
> L. David Baron (2012-03-09 00:34):
> > On Wednesday 2012-03-07 14:57 -0800, fantasai wrote:
> >>
> >> 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.
> > I prefer :column() as it is, and would rather see the reference
combinator use a functional pseudo-class (…).
>
> Maybe pseudo-attributes are more useful than pseudo-classes (and
combinators) here.
>
>  td[:col=1]    {font-weight: bold;}
>  td[:col=2]    {font-style: italic;}
>  td[:col=3]    {font-variant: small-caps;}
>  td[:col#=foo] {background: lime;}         /* or =# */
>  td[:col.=bar] {background: green;}        /* or =. */
>  col#foo       {background: red;}
>  col.bar       {background: maroon;}

That seems exactly the same as the pseudo class approach, except with a
more limited syntax for selecting columns by selector.

~TJ
On Mar 12, 2012 5:13 PM, "Christoph Päper" <christoph.paeper@crissov.de>
wrote:

> L. David Baron (2012-03-09 00:34):
> > On Wednesday 2012-03-07 14:57 -0800, fantasai wrote:
> >>
> >> 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.
> > I prefer :column() as it is, and would rather see the reference
> combinator use a functional pseudo-class (…).
>
> Maybe pseudo-attributes are more useful than pseudo-classes (and
> combinators) here.
>
>  td[:col=1]    {font-weight: bold;}
>  td[:col=2]    {font-style: italic;}
>  td[:col=3]    {font-variant: small-caps;}
>  td[:col#=foo] {background: lime;}         /* or =# */
>  td[:col.=bar] {background: green;}        /* or =. */
>  col#foo       {background: red;}
>  col.bar       {background: maroon;}
>
>  <table>
>    <caption>3*3 table with 4 cells only</caption>
>    <col id=foo><col span=2 class=bar>
>    <tr>
>      <td rowspan=2>
>        td[:col=1][:row=1], td[:col=1][:row=2],
>        td[:col#=foo][:row=1], td[:col#=foo][:row=2]
>      <td colspan=2>
>        td[:col=2][:row=1], td[:col=3][:row=1],
>        td[:col.=bar][:row=1], td[:col.=bar][:row=1]
>    </tr>
>    <tr>
>      <td colspan=2 rowspan=2>
>        td[:col=2][:row=2], td[:col=3][:row=2],
>        td[:col=2][:row=3], td[:col=3][:row=3],
>        td[:col.=bar][:row=2], td[:col.=bar][:row=3]
>    </tr>
>    <tr>
>      <td>
>        td[:col=1][:row=3], td[:col=1][:row=-1],
>        td[:col#=foo][:row=3]
>    </tr>
>  </table>
>
> You can do most of the common things that ‘:column()’, ‘:nth-column()’ and
> ‘:nth-last-column()’ can do, except for advanced stuff like
> “:column(colgroup[span]>col:only-of-type)”.
>
> Note that “:nth-column(1)” ≈ “:column(col:first-of-type)” and
> “:nth-last-column(1)” ≈ “:column(col:last-of-type)”.
>
Received on Tuesday, 13 March 2012 00:42:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT