Re: [CSS3] What about "behavioral extensions to CSS"?

----- Original Message ----- 
From: "Jordan OSETE" <jordan.osete@laposte.net>


> 
> Hello everyone,
> 
> I was wondering what was going on about the "Behavioral extensions to 
> CSS" working draft [1]. It hasn't been updated since 1999, but it seems 
> very interresting extensions to me.
> 
> Specifically, in the first part, the "Event Properties", and "Script 
> blocks" paragraphs seem to me quite stable, and maybe not too hard to 
> implement by user agents (since they only use existing technologies: CSS 
> parser, script interpreter, and events). It would also help 
> webdeveloppers a lot.
> 
> Why hasn't this WD been updated since then? Is no one in the W3C 
> interested in it, or is it because of technical difficulties at the time?
> 
> The "Open issues" part at the end of the document says that:
> 1.    it depends on the DOM Level 2, wich was a WD at the time, but is 
> now a Recommendation, so this point is now useless, and that
> 2.    the order of event handler invocation needs to be specified (in 
> wich order the DOM events, events specified in HTML attributes and 
> events specified in CSS will be called). I don't know if it is that 
> important to specify a specific order now. Maybe it could be left to the 
> UA, or if the developper really needs a specific order (wich will 
> probably be very rare), he would tell it in the CSS. I see 2 easy ways 
> to do this:
>   a) on a per-event basis, after the quoted script, like this:
>     onclick: "myEventListener(this)" order(attrEvents, CSSEvents, 
> DOMEvents);
>   b) Or on an element basis:
>     div {
>       onclick: "handleClick(this)";
>       onmouseover: "handleMouseOver(this)";
>       eventsorder: attrEvents, CSSEvents, DOMEvents;
>     }
> 
> Hope it helps.
> 
> Jordan Osete
> 

As a rule such event handlers constitute closed system of 
functions - a.k.a. as class. 
And 
  div {
       onclick: "handleClick(this)";
       ....
  }
allows you override methods independently which is wrong. 

Better approach is to use 

  div {
       background: white;
       prototype: MyBehavior;
       ....
  }

and in script to define:

var MyBehavior = 
{
     onClick: function() {...}   
     onMouseHover: function() {...}
}
 
I think that it makes sense to take a look on
Ben Nolan's work: http://bennolan.com/behaviour/ 
- same approach is used.

Andrew Fedoniouk.
http://terrainformatica.com

Received on Saturday, 6 May 2006 06:42:57 UTC