Re: Regular Expressions as CSS Selectors?

* Claus Färber wrote:
>what about adding regular expressions to the CSS selector syntax?

I'm in doubt there is any good reason to select parts of a text node
besides ::first-(line|letter|word). If there is something special about
a certain part of it, you should mark up it with appropriate markup.

>This way, one could reference parts of element content that are
>not marked as subelements.

Thus adding semantic value to it.

>For example:
>
>h1 /W3C/        {color:blue}
>/W3C/           {content:url('w3clogo.svg');height:1em}

This syntax isn't compatible with the generic syntax in CSS Level 2.
I don't think CSS 3 will introduce any syntax incompatible with it
(even though if current drafts actually propose incompatible syntax,
as discussed previously).

If there should be such a selector, it would be a pseudo element and
using the Regular Expressions as defined in XML Schema Part 2
Appendix F. The regular expression must be a string token to insure the
content won't be parsed as some other lexical tokens, so we come up to
something like

  ::text("W3C") { color: blue }

>It could, in conjunction with the content property, be even used
>to rewrite the document's text (in some limited way):

Thus violating the WAI guidelines (in some limited way).

>/W3C/   {content: "World Wide Web Consortium"}

  abbr { content: attr(title, string) }
  ...
  <p>... <abbr title="World Wide Web Consortium">W3C</abbr>...</p>

Makes far more sense to me.
-- 
Björn Höhrmann { mailto:bjoern@hoehrmann.de } http://www.bjoernsworld.de
am Badedeich 7 } Telefon: +49(0)4667/981028 { http://bjoern.hoehrmann.de
25899 Dagebüll { PGP Pub. KeyID: 0xA4357E78 } http://www.learn.to/quote/

Received on Friday, 17 August 2001 21:05:21 UTC