[Selectors4] Semantic Pseudo Elements

CSS Selectors are currently designed mainly for mark-up languages that feature named elements and attributes, i.e. SGML, XML, HTML:

  <element attribute="value">content</element>

Some other languages might work, too, such as JSON, if some special conventions are followed:

  { "name": "element", 
    "attributes": {"attribute": "value"}, 
    "contents": "content"
  }

Some pseudo elements ‘::foo’ and pseudo classes ‘:foo’ amend this system with structural and semantic values. Some of them accept parameters in parentheses after them ‘::foo(bar)’, ‘:foo(bar)’. Structures not present in the markup ‘@foo’ are supported to some degree, too.

I think we should add semantic pseudo elements (and classes):
1. To enable syntax highlighting (of computer code, especially).
2. To support lean, non-verbose markup (e.g. Markdown, e-mail and wiki syntaxes).

The first use case would require an extensive analysis of what coders’ text editors currently offer and what common constructs computer languages do use. This is a complex task and should probably done in a module or even a compatible specification of its own.

I assume the second scenario to be less complex and hopefully it could be done within CSS / Selectors.

Received on Monday, 9 May 2011 17:44:38 UTC