- From: Alan Gresley <alan@css-class.com>
- Date: Mon, 17 Mar 2008 04:45:49 -0700
- To: Andrew Fedoniouk <news@terrainformatica.com>
- cc: www-style@w3.org, robert@ocallahan.org
Andrew Fedoniouk wrote:
> I simply forgot to respond, my pardon.
Well I was incorrect. Don't we often ignore ridiculous suggestions and just pretend we didn't see it. :-)
> > Anyhow, to put an end to this whatever, please see this text case.
> >
> > http://css-class.com/test/css/selectors/attribute-dir1.htm
> >
> >
> > [dir="ltr"] {background:red}
> > [dir="ltr"] [dir="rtl"] {background:blue}
> >
> >
> > It will work in most UAs.
> >
>
> Alan, first of all you've forgot about the case:
>
> <body dir="rtl">
> <h1>Hello</h1>
> </body>
>
> and the second:
>
> Selector *:rtl means exactly following:
> "element that has nearest parent (including itself) with defined
> attribute @dir and that @dir attribute has exactly "rtl" value.
>
> In other words: :rtl matches *any* element in rtl environment
> established by itself or one of its parents.
>
> That is different from what you have defined.
Pseudo-classes are slightly different.
li:hover a {background:red}
li:focus a {background:red}
li:rtl a {background:red}
Then I could have.
li:hover {background:blue}
li:focus {background:blue}
All the above occurs after a user action. This is not a user action
li:rtl {background:blue}
but rather an attribute belonging to the source. How can this be described as a pseudo-class? You are talking about a parent or ancestor element with a particular attribute. Almost no selector like that exist in CSS at this current time.
[...]
> In general request "element with nearest parent having defined A of
> exactly value S" is not solvable in terms of CSS selectors for arbitrary
> elements / DOM trees.
>
> --
> Andrew Fedoniouk.
>
> http://terrainformatica.com
I did give the following example in my reply to Fantasai.
*<[dir="rtl"], * *<[dir="rtl"] {background:lime}
That is all wrong because really I want something more like this (disregard the syntax).
*~<[dir="rtl"] {background:lime} /* the first ancestor encountered with rtl direction */
Moving back to the pseudo-class example.
a:focus<li<ul {background:lime}
But I have seen this as
ul(li>a:focus) {background:lime}
which would style the element before the string of descenders. I won't try that with your proposal since it would be nonsense. Your proposal operates more like namespace selectors.
[dir="rtl"]|li {background:lime}
Alan
http://css-class.com/test/
Received on Monday, 17 March 2008 11:46:35 UTC