W3C home > Mailing lists > Public > www-style@w3.org > February 2014

Re: [selectors4][css-syntax] Pseudo-elements vs. combinators

From: Sylvain Galineau <galineau@adobe.com>
Date: Thu, 6 Feb 2014 00:15:51 +0000
To: François REMY <francois.remy.dev@outlook.com>
CC: Tab Atkins Jr. <jackalmage@gmail.com>, Matthew Robb <matthewwrobb@gmail.com>, Brian Kardell <bkardell@gmail.com>, "<www-style@w3.org>" <www-style@w3.org>, Simon Sapin <simon.sapin@exyr.org>
Message-ID: <B0F9F260-B310-4B31-BAE2-D917A2D6A055@adobe.com>

On Feb 5, 2014, at 3:52 PM, François REMY <francois.remy.dev@outlook.com> wrote:

> My current thought on this would be "->" or "=>", because the combinator is a concept similar to mapping an element to a set of elements (if you read from left to right, like web authors do):
> 
>   #some-element -> shadow-tree -> .some-elements { ... }
>   #some-element -> shadow-full-tree -> .some-elements { ... }
> 
> if we want to retroactively express current combinators:
> 
>   #some-element -> descendants -> .some-elements { ... } // ( )
>   #some-element -> children -> .some-elements { ... } // (>)
>   #some-element -> next-sibling -> .some-elements { ... } // (+)
>   #some-element -> next-siblings -> .some-elements { ... } // (~)
> 
> Best regards,
> François
> 
> 
> 
> ________________________________________________________
> [off-topic-post-scriptum]
> 
> because some of us like being crazy, we could even allow the reverse combinator syntax like in
> 
>   .some-elements {
>       color: blue;
>       & <- next-sibling <- .some-other-elements {
>           color: red;
>       }
>       & -> next-sibling -> .some-different-elements {
>           color: green;
>       }
>   }
> 
> aka
> 
>   .some-elements { color: blue }
>   .some-other-elements + .some-elements { color: red }
>   .some-elements + .some-different-elements { color: green } 

This looks more like two -> combinators with a token in between. I think it looks kind of nice in simple cases but the two arrow and extra spaces add 6 additional characters to each combinator name, which gets old once you nest; and once you start nesting you could get something like:

  	article -> shadow -> heading -> descendants -> p…

Where it’s getting a bit harder to spot the combinator names from the element names vs. 

	article ^shadow heading ^descendants p

…which is admittedly more compact and effectively disambiguates combinators from the things they apply to fairly well.
Received on Thursday, 6 February 2014 00:16:21 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:18 UTC