ancestor at-rule

Hi all,

I am using CSS more and more lately, and I notice that I need the following
pattern very often:

A B {...}
A C {...}
A D {...}

I use this f.e. when I have a table that needs to jump out of the rest of
the page, and the <TR>,<TD>,<TH> and often also <A> need to be differnt for
this case. I do not want to add a class to all these elements, so I only add
a class to the table, which results in the following css:

TABLE.special TR {...}
TABLE.special TH {...}
TABLE.special TD {...}
TABLE.special A {...}

This is not only clumsy and ugly, it is also very slow. (As was demonstrated
by similar cases in the UI of Mozilla)

To solve this I'd like to introduce the following:

@has-ancestor TABLE.special {
    TR {...}
    TH {...}
    TD {...}
    A {...}
}

This makes the rule matching much faster, because a UA only has to look for
matches in the subtree of TABLE.special elements.

If anyone has a better solution (especially when it's done with CSS2) please
let me know.

Sjoerd Visscher

Received on Sunday, 5 December 1999 18:45:59 UTC