W3C home > Mailing lists > Public > www-style@w3.org > October 1999

Re: CSS-Transformation mechanism and modularizing CSS

From: Sjoerd Visscher <sjoerd@heeten.nl>
Date: Tue, 5 Oct 1999 23:31:00 +0200
Message-ID: <004401bf0f78$eb864280$1400000a@beneden>
To: "www-style" <www-style@w3.org>

Ian Hickson wrote:
> 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.
I think this is also the best way for attributes.

Chris Wilson wrote:
> Except the content property, in CSS2, only applies to pseudo-elements,
> are not exposed in the DOM as part of the content tree.
But in the Paged Media Properties for CSS3 Working Draft I found this:
A[HREF] { content: "page " target-counter(HREF, page) }
So the content property seems to apply to all elements in CSS3.

> Again, I'm not sure how you're sure that this is a relatively low amount
> extra coding.  Have you implemented it as an experiment in Mozilla or
> something?
No, I cannot find my way through Mozilla's code.
But if you're asking me how to implement this:
I'd start with a copy of the DOM tree.
To this tree I'd apply the CSS rules, calculating the properties,
and creating real element nodes for the pseudo-elements.
In this tree I'd also truly apply the content and attribute changes.
(But the attr() and content() functions retrieve their values from
the original DOM tree)
This tree is then ready to send to the rendering part of the program.
(the rendering part has thus nothing to do with pseudo-elements or
content or attributes properties)
An eventsystem that captures tree changes notifies the CSS implementation
of changes in the DOM tree. It then changes it's tree accordingly.
pseudo-classes can also cause the CSS tree to change.
The rendering system then gets notified of the changes in the CSS 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
> those set in the document and the access through the DOM.

6.4.4 Precedence of non-CSS presentational hints
The UA may choose to honor presentational hints from other sources than
style sheets, for example the FONT element or the "align" attribute in HTML.
If so, the non-CSS presentational hints must be translated to the
corresponding CSS rules with specificity equal to zero. The rules are
assumed to be at the start of the author style sheet and may be overridden
by subsequent style sheet rules.

You see, if you follow the above mentioned algorithm, nothing happens if
sets an attribute through the DOM. Which is correct becuase it is non-CSS
so it has the lowest specifity possible. (If he wan't to see another image,
he'll have to set the src2 attribute!)

I hope this solves some issues, but probably not all...

Sjoerd Visscher
Received on Tuesday, 5 October 1999 17:33:50 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:51 UTC