Re: CSS-Tranformation mechanism and modularizing CSS

On Tue, 5 Oct 1999, Sjoerd Visscher wrote:

> Almost all concerns I read, have the same problem with the content
> property. f.e.:
> 
>    IMG[src="x"]:hover {
>        @attributes {
>            src: "y";
>        }
>    }
>    IMG[src="y"]:hover {
>        @attributes {
>            src: "x";
>        }
>    }
> 
> has currently the same problem with:
> 
>    IMG["x"]:hover {
>        content: "y";
>    }
>    IMG["y"]:hover {
>        content: "x";
>    }

What does this mean?

If you mean this, based on the current CSS3 selectors draft:

   IMG"x":hover {
       content: "y";
   }
   IMG"y":hover {
       content: "x";
   }

...or this, which uses my not-yet-proposed selector syntax:

   IMG="x":hover {
       content: "y";
   }
   IMG$="y":hover {
       content: "x";
   }

...and which means the same thing, namely a substring search of the
flattened DOM content of IMG element, hen there is no problem: the
'content' property DOES NOT change the contents of the element as far
as the DOM is concerned, it only changes the presentation of the
element. (This is equivalent to the fact that changing the
'background-color' property of the BODY element doesn't change the
BGCOLOR attribute of the BODY element.)

Your example _transforms the original DOM tree_. This is incompatible
with the way CSS works (it annotates/decorates a rendering tree based
on the DOM tree).

 
>> I'd also point out that you're setting the src attribute based on a
>> state here - what happens if someone comes in through script and
>> explicitly sets the src to something else while you're in that
>> state? What happens, then, when you move the cursor away? There is
>> a considerable amount of specification work that would need to be
>> worked on here, with a model for how attributes set through your
>> proposed stylesheet extensions interact with those set in the
>> document and the access through the DOM.
> This should also be wondered about the content property.

This is what DOM2 is covering, so there is no need to wonder.


> If somebody has problems concerning changing attributes, that does
> not apply to the content property, please send them.

I have yet to see any unresolved concerns which apply to the 'content'
property at all. 

The issue at hand is that the CSS model works something like this:

   DOM -> CSS -> RENDERING

...whereas you are suggesting doing this:

   DOM -> CSS \
   /|\        | -> RENDERING
    \_________/

CSS itself has never been able to change the DOM based on state
changes. (Note that the BECSS proposal carefully doesn't propose that:
according to BECSS the DOM can only change on an *event* -- changes to
the DOM cannot trigger scripts.)

-- 
Ian Hickson
"I take a Professor Bullett approach to my answers. There's a high
probability that they may be right."
  -- Dr Snow; Mechanics Lecturer at Bath University; 1999-03-04

Received on Tuesday, 5 October 1999 11:08:55 UTC