W3C home > Mailing lists > Public > www-style@w3.org > May 2011

Re: [Selectors4] Semantic Pseudo Elements

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 9 May 2011 14:08:50 -0700
Message-ID: <BANLkTikbfMnKKSW0p-6Ypy0Jg0EiOxxsmg@mail.gmail.com>
To: Eduard Pascual <herenvardo@gmail.com>
Cc: Christoph Päper <christoph.paeper@crissov.de>, W3C style mailing list <www-style@w3.org>
On Mon, May 9, 2011 at 11:35 AM, Eduard Pascual <herenvardo@gmail.com> wrote:
> On Mon, May 9, 2011 at 7:44 PM, Christoph Päper
>> 2. To support lean, non-verbose markup (e.g. Markdown, e-mail and wiki
>> syntaxes).
>
> Nothing prevents CSS from working on other markup. All you need is a parser
> for whatever document language you want to use that builds something
> resembling a tree structure from it (the DOM), and then you can go and
> render that DOM applying CSS rules. For any given markup language, you'd
> need to define what are elements and what are attributes (although
> attributes don't even need to exist). The X/HTML, SGML, and XML language
> families just have the advantage of this being already well defined. Just
> because there isn't any widely known implementation of CSS for some unusual
> language doesn't mean it's not doable.
>
> As a matter of fact, the terminology on the CSS specs is rather generic when
> referring to the "document language" just to avoid shutting down this
> possibility (sure, examples and the like are HTML-based: nobody can change
> the fact that CSS was designed for HTML after all).

Eduard is completely correct.  CSS is defined in terms of the "element
tree" and the "box tree", both of which are abstract and not
explicitly tied to any particular language.  Any language which is
vaguely tree-structured can be converted into an element-tree, as it's
just a bunch of nodes potentially containing two properties that are
strings (we call them "tagname" and "id"), one property containing a
list of strings (we call them "classes"), and one property containing
a list of string pairs (we call them "attributes").  For example,
WebVTT, the proposed captioning/subtitling language for the web, is
nothing like HTML, but still defines how to parse it into an
element-tree.

I also agree in general with the rest of Eduard's response.  Syntax
highlighting is not something that can be usefully defined at the CSS
level, as it involves far too much personal choice as to what's an
appropriate granularity, plus rules for every language - it should be
done by a parser breaking up the code into styleable units, which CSS
can then be applied to in the usual way.

~TJ
Received on Monday, 9 May 2011 21:09:44 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:40 GMT