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

> Decorators, shadow DOM and all of that is all very interesting, and 
> opens up many possibilities, but they're quite complicated proposals 
> and verbose in syntax. 

I agree with you on this. They could be made more seamless for the more general cases. I don't think the CSSWG discussed this either, so that may still come at some point.


> I think CSS zen garden serves as a good example where decorators 
> would probably be useless. Decorators use HTML, therefore, if you have 
> a situation where you cannot modify or add HTML, decorators are going 
> to be of little use. 

Decorators do not have to be in the same file as your primary HTML. The same way you can link to an image or a font from your CSS file, you can link to your favorite decorator libraries. I'm also not against declaring decorators using CSS directly for the cases where HTML features are not needed. Something like

   @decorator video {
      content: contents slot(icon) slot(text);
      @slot(icon) { content: ' V'; font-family: ...; }
      @slot(text) { content: ' video'; }
   }

or, for the spec sample:

   @decorator fog {
      content: slot(wrapper);
      @slot(wrapper) {
         content: contents slot(overlay);
         position: relative;
      }
      @slot(overlay) {
         position: absolute; top...;
         background: rgba(...);
      }
   }

or, with insertion points, why not:

   @decorator only-first-image {
      content: contents(img:first-of-type);
   }

This gives you the same expression power as the ::inside/::outside pseudo-elements because you can unwrap slots at any time, but this seems more elegant to my eyes. The downside of CSS slots over HTML ones is that you can't define events on them (at least, there's no way to do this currently).



> 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") { }? 

The solution I've found to bring sane order of named values to list-valued properties would not work on pseudo-elements. That does not mean there's no way to find a solution that works in that case, however. 

Anyway, as I said, it's likely multiple before/after pseudo-elements will be introduced at some point; people like Alan Stearns have pushed for that and I didn't hear many people saying we might want to delay the feature a bit to introduce it (the way I think is) the right way.


François 		 	   		  

Received on Tuesday, 30 April 2013 13:42:40 UTC