Re: [css4-pseudo] The need for more powerful pseudo elements

> Le 30/04/2013 00:59, Tom Wardrop a écrit :
>> Also, if ordinals are such a pain in the ass (I don't really like them
>> myself), is there any particular reason why ::before and ::after can't
>> be named, e.g. span::after(shadow) { } or span::after("my shadow") { }?

> I like this idea. Flexbox’s 'order' property could be use to order the 
> pseudo-elements of the same element, but we’d still need a way to 
> consistently order pseudos that have the same 'order' value, or where 
> it’s just not specified.

I'm a huge fan of this idea.  The spec even has an issue raised that we could increase flexibility of pseudo-elements by naming them, but the potential syntax of that is unclear.

Last time this came up, it was mentioned that the ordinal is the *identity* of the element, but I think a possible proposal would be:

<selector>::after(pseudo-element-name) {
  order: <number>;
}

If the "order" attribute is omitted, they should be applied in the order they're declared.
This would be safe, because then all pseudo-elements would be named and you wouldn't have to worry about interacting based on ordinal.  
However, that *would* leave some ambiguity around `::before`.  I propose that, like the current doc, it always be given "order: 1;" and that in the case where multiple pseudo-elements are given the same order, ::before *always be applied first*, then the others in declaration order.

http://dev.w3.org/csswg/css-pseudo/#gen-content

Received on Tuesday, 30 April 2013 16:40:36 UTC