Re: Question: Identation based on first child, how?

On Mon, 15 Mar 1999, Daniel Glazman wrote:

>>    DIV:contains(H2) { margin-left: 10%; }
> I would prefer
>   DIV:selected > H2
> where one :selected pseudo max is allowed per selector and means
> that the corresponding element is the subject of the selector. If no
> :selected is in the selector, then the normal rule applies and the
> subject of the selector is the last selected element in the
> selector.

I have three problems with this idea.

  a. This idea adds rules that the formal grammar will find it very
     difficult to enforce (i.e., that only one :selected pseudo
     is allowed per selector).

  b. The pseudo is neither a pseudo-class nor a pseudo-element. In
     fact, it is not a selector at all. This is considerably different
     to the current conventions.

  c. This idea is less powerful that the :contains pseudo-class, and
     not considerably simpler to implement.

To illustrate point c, consider how you would do the following using
your idea:

   FORM:contains(BUTTON[onclick]) INPUT[type=submit]
       { display:none; }

   /* Hides INPUT element of type submit when there is a BUTTON 
      element with an onclick handler in the same form. */


   BASKET:contains(APPLE):contains(PEAR):contains(BANANA):before
      { content: "Basket contains all three types of fruit." }


   BODY:contains(BLOCKQUOTE P IMG.signature)
     { status: "This page contains a signed document" }

   /* Uses another CSS3 suggestion to change the status line text
      of documents containing 'signed documents'. */


   GARDEN:contains(TREE:contains(BIRD) + TREE:contains(CAT)) SIGNPOST:before,
   GARDEN:contains(TREE:contains(CAT) + TREE:contains(BIRD)) SIGNPOST:before,
     { border: red double; content: "DANGER!"; display: block;
       text-decoration: blink; }

   /* Posts a warning if a cat in a tree is adjacent to a bird in a
      tree. */
   

-- 
Ian Hickson 
U+2642 U+2651
U+262E U+2603 U+263A

Received on Monday, 15 March 1999 15:38:10 UTC