W3C home > Mailing lists > Public > www-style@w3.org > December 2006

Re: Extending CSS

From: Dave Raggett <dsr@w3.org>
Date: Sat, 30 Dec 2006 12:47:50 +0000 (GMT)
To: Anne van Kesteren <annevk@opera.com>
Cc: www-style@w3.org
Message-ID: <Pine.LNX.4.64.0612301216530.5325@holly>

On Sat, 30 Dec 2006, Anne van Kesteren wrote:

> On Sat, 30 Dec 2006 12:47:25 +0100, Dave Raggett <dsr@w3.org> wrote:
>> A lightweight declarative means to declare properties that are 
>> interpreted via the getComputedStyle interface would be really 
>> valuable and something that was overlooked in previous work.
>
> I don't think it was overlooked. CSS is designed in a way that 
> everything that is not understood will be dropped and therefore 
> doesn't end up in the CSSOM (CSS Object Model). I'm not sure if 
> you really want to make it more complex.

One motivation is to be able to declare and interpret new CSS 
properties, such as as the CSS3 speech properties prior to 
standardization. Another is where the declarative nature of CSS 
makes it attractive to define new properties for specific kinds of 
applications. Why can't CSS be extensible like well-formed XML? 
Having the CSS engine discard unknown properties may provide a point 
of extensibility to browser vendors, but it doesn't help application 
developers when they want to define an extension themselves.

If browser vendors are uncomfortable with the idea of interpreting 
CSS syntax expressions, an even lighterweight solution would be to 
pass the property string to a handler declared by the script when it 
registered the new property.

The simplest registration interface for this would need to:

   a) specify the property name
   b) specify a handler for parsing the value

The handler would be passed a DOM node as matched by the selector
and would return the parsed value. This would be stored and made
available via later calling getComputedStyle() on the node.

A more sophistocated version would:

   a) specify the property name
   b) specify the initial value
   c) specify whether it is inherited or not
   d) specify what percentages apply to (if used)
   e) specify the property value syntax as a string

Examples of the syntax are scattered through out the CSS 
specifications, e.g. for rest-after in CSS3 speech:

"<time> | none | x-weak | weak | medium | strong | x-strong | inherit"

With the advent of just in time compilation for JavaScript, we 
shouldn't be overly concerned about processing speed, which is 
already good enough even without JIT compilation.

  Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
Received on Saturday, 30 December 2006 12:48:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:48 GMT