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

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

From: Sam L'ecuyer <sam@cateches.is>
Date: Sun, 28 Apr 2013 11:57:41 -0700
Message-ID: <517D7125.5040207@cateches.is>
To: François REMY <francois.remy.dev@outlook.com>
CC: Tom Wardrop <tom@tomwardrop.com>, "www-style@w3.org" <www-style@w3.org>
On 4/28/13 6:24 AM, François REMY wrote:
> I understand the uses cases but I'm still thinking multiple after/before pseudo-elements isn't the solution we are looking for. Using genereated content for styling is a hack we shouldn't support too much.
>
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"
iirc, Tab said he supported arbitrarily nested pseudo-elements.

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).  So I'd have

<h3 class="headline" data-content-access="premium" 
data-content-type="video">Stock Prices Plummet</h3>

[data-content-access="premium"]::after(1) {
     content: "VIDEO";
}

[data-content-access="premium"]::after(1)::before {
     content: "V";
     font-family: 'IconFont';
}

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.

Moving towards a more semantic web, I think providing complex styling 
and generated content based on metadata is an extremely valid use case.  
And, as a developer at a large media company, I can say that a) this is 
something that is desperately desired, and b) developers are trying to 
move in this direction whether or not the w3c wants them to.

-s
Received on Sunday, 28 April 2013 18:58:06 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 28 April 2013 18:58:07 UTC