W3C home > Mailing lists > Public > www-style@w3.org > September 1999

selector matching question

From: Ranjit Singhe <ranjit_singhe@mail.com>
Date: Mon, 20 Sep 1999 15:01:08 -0400 (EDT)
Message-ID: <384294917.937854068502.JavaMail.root@web04.pub01>
To: www-style@w3.org

this (i hope) is not a css writing question. it is more a selector matching
question.  i've attached a simple html file that uses styles.

it has to do with ancestral resolution.  when you look at the html it should
be fairly clear what i'm trying to do.

for a while now i've been using gecko to test my resolution cases, so try it
in gecko; hence this post. :)

here's my question (the atmt. reflects this case):

if an element (SPAN) has two ancestors of the same name (OL)

+-- DIV
+-- DIV
+-- OL
+-- DIV
+-- DIV
+-- OL
+-- SPAN
+-- (Text)

and there are two styles in order as follows:

DIV > DIV OL SPAN { color: blue }          --- (1)
DIV + DIV OL SPAN { color: magenta }       --- (2)

what is the color of (Text) ??

i think it should be magenta 'cos:
a. OL parent of SPAN is found
(1) succeeds
(2) fails
b. because 2 failed, we look further up and find
OL parent of DIV
(1) fails
(2) succeeds
c. because 1 failed, we look further up and find no
more ancestors with name OL

because (2) is chronologically after (1), the text should be magenta 'cos it
beats (1) on the collisions.  (i say this 'cos the specificity (= 4) and
owner (= author) are the same.)

even if (1) and (2) had succeeded at stage b., (2) would win because of the
chronology contest.

am i right???


-- ranjit

FREE Email for ALL! Sign up at http://www.mail.com

Received on Monday, 20 September 1999 15:01:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:51 UTC