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

Re: ancestor at-rule

From: Matthew Brealey <thelawnet@yahoo.com>
Date: Mon, 6 Dec 1999 03:32:56 -0800 (PST)
Message-ID: <19991206113256.6880.qmail@web901.mail.yahoo.com>
To: www-style <www-style@w3.org>
--- Sjoerd Visscher <sjoerd@heeten.nl> wrote:
> 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.

Apart, obviously from TABLE.special *, there is none,
and neither should there be IMHO.

CSS extensions should be limited to those that allow
us to do what we couldn't do using CSS before, so IMO
this is barely an improvement, since it would be
almost as quick to have 
> TABLE.special TR {...}
> TABLE.special TH {...}
> TABLE.special TD {...}
> TABLE.special A {...}
than have to bother with an @ rule as well.

=====
----------------------------------------------------------
From Matthew Brealey (http://members.tripod.co.uk/lawnet (for law)or http://members.tripod.co.uk/lawnet/WEBFRAME.HTM (for CSS))
__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com
Received on Monday, 6 December 1999 06:32:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:01 GMT