W3C home > Mailing lists > Public > www-style@w3.org > August 2001

Re: Regular Expressions as CSS Selectors?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 18 Aug 2001 03:04:15 +0200
To: list-w3c-style@faerber.muc.de (Claus Färber)
Cc: www-style@w3.org
Message-ID: <jmfrntggh5tvbq85kkf6i1mqn6irdonbnc@4ax.com>
* 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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:10 GMT