Re: Why no Parent Selector?

> Is there any particular reason there is no parent selector (say: <) to 
> select the parent of an element?  Putting together documents, I have come 
> across many cases where this would be handy, and one time needed a little 
> JavaScript hack to apply a style to the parent of an element, certainly not 
> the best solution for something so simple.  One example is when in a 
> paragraph I include a small piece of very important text (say a 
> SPAN.warning).  I would like to mark the entire paragraph (say with a 
> danger icon in the margin of the paragraph).  Another simple example is  to 
> draw attention to the locations of HTML editing markup, especially useful 
> when working with a long document:
> 	DEL<P, INS<P {border-left: thick red solid;}
> 
> The drawback I can think of is the style would have to be applied after the 
> UA reads the entire element to determine its contents, but this is not 
> unusual; the UA often needs to do this anyway since the overall size of a 
> block can depend on the sizes of the elements within.
> 
> If this seems like a good idea, I respectfully submit it to this forum as a 
> suggestion.

Yes it is. I think that you'll be happy reading the W3C Selectors
Working Draft [1]. It introduces the :subject selector. So selecting a
P that contains a DEL is written

	P:subject > DEL

[1] http://www.w3.org/TR/CSS3-selectors

</Daniel>

Received on Tuesday, 30 November 1999 10:21:54 UTC