Re: first-word pseudo-element

* Sean B. Palmer wrote:
>You might consider a "to-content" selector then, where it applies
>style until the first occurance of a certain character, or set of
>characters (non inclusive). "First word" would be like :to-content("
>") or whatever.

It should be consistent with XPath, so

  elem::substring-before(" ") { font-size: xx-large }

would be a better approach. In addition a substring-after pseudo-element
could be included like

  elem::substring-after(" ")  { color: inherit }

A proposal:
-----------

  The ::substring-before(string) pseudo-element

    The substring-before pseudo-element selects the substring of the
    textual content of the given element that precedes the first
    occurrence of the string provided as argument to the selector; it
    selects nothing if the textual content does not contain the desired
    string.

    Example:

    code::substring-before("/*")

    selects everything before the first comment in this code fragment

    <pre><code>
    UL OL LI.red    /* a=0 b=1 c=3 -> specificity = 13 */
    </code></pre>

  The ::substring-after(string) pseudo-element

    The substring-after pseudo-element selects the substring of the
    textual content of the given element that follows the first
    occurrence of the string provided as argument to the selector; it
    selects nothing if the textual content does not contain the desired
    string.

    Example:

    p::substring-after("CSS")::substring-before("3")

    selects the string "level" in this paragraph:

    <p>This draft describes the selectors that are proposed for CSS
       level 3</p>

    [1]

If these pseudo-elements are included in the draft, :contains
pseudo-class semantic needs to be extended to process only the selected
substring if called in context of one of the substring-pseudo-elements;
all three pseudos need some clarification on white-space normalization
as I stated earlier. 

See 

  http://www.w3.org/TR/xpath#function-substring-before
  http://www.w3.org/TR/xpath#function-substring-after

for the definition of these functions in XPath.

[1] "level" with uppercase "L"
-- 
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 Thursday, 17 May 2001 13:09:44 UTC