W3C home > Mailing lists > Public > www-style@w3.org > April 2013

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

From: François REMY <francois.remy.dev@outlook.com>
Date: Sun, 28 Apr 2013 22:34:28 +0200
Message-ID: <DUB120-W114C23BCD1A7C1C55346EDA5B10@phx.gbl>
To: Sam L'ecuyer <sam@cateches.is>
CC: Tom Wardrop <tom@tomwardrop.com>, "www-style@w3.org" <www-style@w3.org>
> From: sam@cateches.is 
> I disagree. Although it's ripe for abuse (like most things), this was 
> discussed in last week's thread "[css4-pseudo] multiple and 
> nested pseudo-element ordering" 

To be honest, I had a flag on this mail as a potential reply-to subject ^_^

> The use case for me, though, was that I had a large amount of metadata 
> in data-attributes on an element and wanted to display tags after the 
> content (newspaper headlines are the context). 

Yes, this is a *much* better use case, without any doubt. But, still, you can solve it using only one after pseudo-element and decorators:

  [data-content-access="premium"]::after { 
    decorator[premium]: premium-decorator;
  [data-content-type="video"]::after { 
    decorator[video]: video-decorator;

  [data-content-subtype="porn"]::after {
    decorator[video]: porn-video-decorator;

with premium decorator, video-decorator & porn-video-decorator being small markups that will represent your shadow DOM elements.

The advantage of decorators is that they are way more powerful than generated content.

> That way, I can create a series of ::after()s, each with its own 
> (small) tree based on metadata. This is especially helpful when some 
> of the metadata is generated via javascript after the page loads. We 
> don't want to create and append nodes, we'd just like to be able to say 
> .setAttribute("data-content-type","blog") and have the rest take care 
> of itself. 

It's not really the role of CSS to handle markup, if you want my opinion. But this advantage is preserved by the decorator solution, anyway, it's just the way get defined that is changed.

I'm really concerned that with CSS-defined markup, we risk to let authors morph the layout DOM tree in subtle ways that could be really hard to debug.


Disclaimer: I'm not a member of the CSS Working Group so don't take everything I say for a W3C opinion. I'm neither able nor mandated to represent this group's opinion ;-) 		 	   		  
Received on Sunday, 28 April 2013 20:34:58 UTC

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