Re: first-word pseudo-element

Bjoern Hoehrmann wrote:
> 
> >> That said, ":first-word" would be a one-off.  I'd be much more
> >> interested in a ":first-n-words" and ":first-n-letters".
> 
> That should be ::first-words(n) and ::first-letters(n) otherwise it
> would be hard to read. I must say, I don't really like this pollution
> with selectors. Hm, there are a lot of selectors selecting 'first',
> 'last' and 'nth' and especially 'child', i.e. [1]
> 
>   E:first-child
>   E:last-child
>   E:only-child
>   E:nth-child(expr)
>   E:nth-last-child(expr)
> 
>   E:nth-last-of-type(expr)
>   E:nth-of-type(expr)
>   E:first-of-type
>   E:last-of-type
> 
> So we have 6 methods (remember the child combinator) to select distinct
> kinds of children of an element. Is this really necessary? I could live
> with
> 
>   e:child(first)
>   e:child(last)
>   e:child(only)
>   e:child(even)
>   e:child(odd)
>   e:child(4n+4)
> 
> or
> 
>   ...
>   e:children(even)
>   e:children(odd)
>   e:children(4n+4)
> 
> if readability is an important issue.
> 
> I don't know if it is possible to express nth-last-child with this
> nn+/-x-Syntax but I can live without that selector :) 

See

  fantasai. "On nth-child, etc..", www-style. 2001-03-10
  http://lists.w3.org/Archives/Public/www-style/2001Mar/0078.html

and ensuing thread.
  

> :first-child could be marked deprecated and kept for compatibility 
> reasons.
>
> Another approach would be to express the nth-thing in another way to
> have a generic mechanism to select nth-words, nth-lines, nth-children,
> nth-etceteras... I have to think about that...

Actually, I kinda like the :child(expr) syntax. :)
It's come up before, too...

The problem with generalizing the syntax for words, lines,
children, etc., is that it will obscure the semantics of 
the pseudo-class. There already /is/ a generic mechanism 
for specifying a pseudo-class--the colon. The fact that 
all these pseudo-classes have the same form is no reason 
to abstract the syntax another level.

> What does
> 
>   elem:not(elem::first-line)::first-line { }
> 
> select? Do typographic pseudo-classes and -elements apply to concat'ed
> element content or to the context of the current selection?

I believe you're only allowed to take a psuedo-element of the
selected element.

http://www.w3.org/TR/css3-selectors/#pseudo-elements

Received on Friday, 18 May 2001 17:25:44 UTC