target-attr() and /reference combinator/ proposals

Summary: Two proposals, one for the "target-attr" omission in the CSS3
Paged Media WD, and one for a reference combinator.


1. 'target-attr':

The W3C Paged Media Properties for CSS3 draft [1] introduces two new
functions, 'target-counter' and 'target-content'. 

I would like to propose that this set also include 'target-attr',
which does the analogous thing for attributes.

For example:

   A[href]:after { content: ' (' target-attr(href, title) ')'; }


2. Reference Combinator:

I have also been thinking of proposing a new combinator, the reference
combinator, which matches elements which are pointed to by a
particular attribute of another element, for example:

   A /href/ *:after { content: ' (referred to from elsewhere)'; }
   IMG /usemap/ MAP AREA { display: list-item; }

The idea is the same as with other combinators:

   A /attribute/ B

...matches an element B if the element A has an attribute 'attribute'
which points to the element B, as in:

   <A href="#bee"/>  <B id="bee"/>

This would be useful with the 'target-attr' function:

   A:selected /href/ [title] { color: green; } /* CSS3 WD syntax */
   A:matches( /href/ [title] ) { color: green; } /* my proposed new syntax */
   (A) /href/ [title] { color: green; } /* Another alternative syntax */

The above would match an element A only if the element which it points
to (with its "href" attribute) has a title attribute. (I'll note again
in passing that my :matches proposal is not particularly longer than
the WD's version of the same idea, except that it _is_ a selector,
unlike the 'imposter' known as :selected, and that it is much easier
to extend in later CSS versions to allow more complicated expressions.)

Is anyone violently disgusted by this combinator proposal?
Does it seem reasonably feasible to implement?

-- 
Ian Hickson                            ("`-''-/").___..--''"`-._   
http://www.bath.ac.uk/%7Epy8ieh/        `6_ 6  )   `-.  (     ).`-.__.`)
                                        (_Y_.)'  ._   )  `._ `. ``-..-' fL
Member, Mozilla Quality Assurance     _..`--'_..-_/  /--'_.' ,'
Browser Standards Compliance Team    (il).-''  (li).'  ((!.-'    

Received on Friday, 21 January 2000 23:46:34 UTC