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

Re: [Selectors4] Semantic Pseudo Elements

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Wed, 11 May 2011 23:36:20 +0200
Message-Id: <2738A886-56DF-483F-9484-2EFB555FD40F@crissov.de>
To: W3C style mailing list <www-style@w3.org>
Tab Atkins Jr.:
> On Wed, May 11, 2011 at 8:41 AM, Christoph Päper
>> I want a single token that implementers, authors and users can rely upon, e.g. in a common default stylesheet.
>> Whether that token be ‘emphasis’, ‘:emphasis’, ‘::emphasis’, ‘@emphasis’ or something else is really a secondary point. I just believe that pseudo classes, i.e. one preceding colon, make the most sense, also given the link precedent.
> 
> That's for the markup languages and the implementors of the UAs that natively support such markup languages to decide.

If there already were semantic “anchors” they’d be likely to use them. Here is a first, quick draft with several options for pseudo class names and with equivalents from HTML (and from XHTML2/HTML5 proposals):

  :block ⇐ :parapgraph, :heading, :list, :tabular, :quotation
  :section, :chapter ⇐ <section>, <article>, <div>
  :paragraph ⇐ <p>
  :heading ⇐ <h1>–<h6>, <h>

  :emphasis ⇐ <em>, <strong>
 
  :link (is already there, with :visited) ⇐ <a>, (<link>)

  :list ⇐ :simple-list, :complex-list
  :simple-list ⇐ :collection, :sequence
  :collection, :unordered-list ⇐ <ul>
  :sequence, :ordered-list, :numbered-list ⇐ <ol>
  :array, :definition-list, :complex-list ⇐ <dl>
  :map, :pair (of :key(s) and :value(s)) ⇐ <di>
  :item, :list-item ⇐ :bullet, :step, :entry, :pair
  :bullet, :unordered-list-item ⇐ <li>
  :entry, :numbered-list-item ⇐ <li value="X">
  :step, :auto-numbered-list-item ⇐ <li>
  :key, :topic, :defined-list-item ⇐ <dt>
  :value, :description, :defining-list-item ⇐ <dd>

  :quote ⇐ <q>
  :quotation ⇐ <blockquote>

  :verbatim, :plaintext ⇐ <pre>

  :divider ⇐ <hr>, <br>

  :code ⇐ <code>
  :index ⇐ :sub, :super
  :sub, :subscript ⇐ <sub>
  :super, :superscript ⇐ <sup>
  :math ⇐ <math>, <var>
  :formula ⇐ <math>

  :replaced ⇐ :image, :video, :audio, :embed, :formula
  :image ⇐ <img>, <svg>, <object>
  :video ⇐ <video>, <object>
  :audio ⇐ <audio>, <video>, <object>
  :embed, :application ⇐ <embed>, <object>, <iframe>

  :title ⇐ @title
  :caption ⇐ <caption>, <figcaption>
  :figure (with :caption) ⇐ <figure>
  :table (with :caption and all) ⇐ <table>

  :tabular ⇐ <table>/<tbody>
  :row, :table-row ⇐ <tr>
  :cell, :table-cell ⇐ :header-cell, :data-cell
  :header, :header-cell, :table-header-cell ⇐ <th>, <td scope="X">
  :data, :data-cell, :table-data-cell ⇐ <td>

Form element selectors left out and some others probably forgotten.

> This sounds like a problem we can avoid caring about until it actually appears.

Perhaps. Selectors level 4, though, is not due tomorrow and this can also have benefits for languages like HTML, where explicit markup is missing, e.g. the proposed ‘di’ element surounding ‘dt’s with succeeding ‘dd’s.

> If multiple markup languages are supported that all have spans of emphasis, they can all agree that the tagname for it is "em" as easily as they can agree that they should be matched by the ":em" pseudoclass.

This is only true for languages without inherent element names. ‘emph’ would not work well as a selector for HTML’s ‘em’ element type, but ‘:emph’ could.

> You talk about at least two classes of markup you want to style: plaintext markup languages
> like Markdown and Wikitext, and source code.  These have a very disjoint set of semantics.

Yes. CSS would use pseudo classes for lightweight, plaintext markup languages and it would use pseudo elements for code highlighting, because there is no markup at all in the source.
Received on Wednesday, 11 May 2011 21:37:21 GMT

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