- From: Matthew Brealey <thelawnet@yahoo.com>
- Date: Wed, 10 Nov 1999 03:44:26 -0800 (PST)
- To: www-style <www-style@w3.org>
--- "Braden N. McDaniel" <braden@endoframe.com> wrote: > On Mon, 8 Nov 1999, Matthew Brealey wrote: -------------------------------------------------------Attribute > > selectors: > > > > At present TABLE[border="0"] does not match > <table>, > > even though it actually has no border. > > > > However, I would propose a refinement to the > attribute > > selector, where > > TABLE[border=/"0"] matches TABLE with border > > explicitly 0 or at its initial value. > > Interesting idea, but having a selector that would > match when a specified > attribute is *not* set strikes me as a more flexible > solution. Maybe > something like > > [!att] > > Thus, to replicate the effect of your example: > > table[border="0"], table[!border] The ultimate in flexibility for ! is achieved by making it not a combinator, but a negator. Thus P:!first-child = P:not-first-child P.!x = P that is not of class x. !(P.x) - not P class x !(P.x) & (#!id) - not P.x and not id=id either. So, !P means not P, BODY !> P means P that is not a child of BODY (because the ! serves to negate that which immediately follows it). Equally, DIV ! H1 means not a descendant, so it matches all P's that are not descendants of DIV. Specificity: I would suggest that the negator doubles the selector's normal specificity. Thus !(P#x) = 101 * 2 = 202. I would be inclined to give the & combinator zero specifity, because the fact that it will contain at least two simple selectors gives it sufficient specifity. ----------- If you allow :contains as well, I think the CSS selector syntax is given the richest possible syntax, with the fewest possible things to remember. Thus DIV:!(contains(P)) - DIV does not contain a P. DIV:contains(!P) - DIV does not contain a P. ------------ The negator is definitely a huge advance on the WD, since it contains far more selectors - not-first-child, not-last-child, not-last-of-type, not-first-of-type, not-only-child, not-only-of-type. In addition, it can't do things like E !~ F ===== ---------------------------------------------------------- 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!? Bid and sell for free at http://auctions.yahoo.com
Received on Wednesday, 10 November 1999 06:44:28 UTC