Re: [CSS] Would be nice if...

David Dorward wrote:
>
> On 8 Jan 2008, at 20:09, Andrew Fedoniouk wrote:
>> ... CSS will allow to define values of attributes of elements.
>
> Please, no. That would require every user agent to support style 
> sheets before they could process documents.
>
> html {
>   @lang: 'en';
> }
>
> Now GoogleBot has to support CSS in order to determine the language of 
> the document.
>
> We have markup to define values of attributes of elements, we don't 
> need another way to do it.
>
Seems like my wording was not clear enough.

Imagine that your UA allows you to define custom *CSS attributes* like

#myelem
{
    @min: "10"; 
}
or
#myelem
{
    -min: "10"; 
}

Imagine also that implementation of input[type="range"] element 
(behavior,driver,control, etc.) gets attribute
value as:

<pseudocode>
   value element::get_value_of_min()
  {
      if( this.attributes.has("min")  ) return this.attributes.get("min");
      if( this.style.has("@min")  ) return this.style.get("@min");
      return value::undefined;
  }
</pseudocode>

Having these two features allows you to define min/max values for group 
of range elements in CSS.
So technically this is not
  "CSS will allow to define values of attributes of elements"
but rather
  "Could we have a notation that will allow to define custom attributes 
in CSS?"

These custom attributes will help in other places too.
For example Ben Nolan's behaviors [1] can be implemented better -
at least his implementation will not require hand made CSS selector 
processor (in JS).

--
Andrew Fedoniouk.

http://terrainformatica.com

[1] http://www.bennolan.com/behaviour/

Received on Wednesday, 9 January 2008 20:27:00 UTC