Re: [css3] Proposal

----- Original Message ----- 
From: "Matthew Raymond" <mattraymond@earthlink.net>
Subject: Re: [css3] Proposal


> Andrew Fedoniouk wrote:
>> From: "David Woolley" <david@djwhome.demon.co.uk>
>> | I agree with others that this is behaviour, and doesn't belong in
>> | CSS.
>>
>> behavior is a module of CSS3 as far as I can see:
>> http://www.w3.org/TR/css3-roadmap/#becss
>
>   Considering XBL 2.0 is further along (Last Call) and is vastly
> superior, I'd suggest we use that for binding behavior instead of a spec
> that hasn't been updated in over seven year.

I really do not understand why for such simple task as
element<->event handler(s) binding you need special (third) language as
the XBL?

Here are practical examples [1,2] of  CSS class <-> event handlers binding
that work already in all current UAs.

Explanation of the idea:

To be able to bind scripting code to elements in some document
you need to define a table [CSS selector] <-> [event handler object]

var myrules =
{
   'span.class1' :
   {
      onclick : function()   { .... }
      onblur : function()   { .... }
   },
   '#products li' :
   {
      onclick : function()   { .... }
   }
};

and run binding function inside window.onLoad.

That is pretty simple. So why XBL?


>
>> So it already belongs to CSS somehow.
>
>   Sort of. You should be able to bind presentational behavior via CSS,
> but behaviors themselves should not be defined within CSS.

Agreed.

BTW:
I would like also to see something like @include:
@include mime-type url list-of-media-types;

That will allow to define styles like this:

@media screen
{
     @include "text/javascript" url( date-time-behavior.js );

     intput[type="text"].datetime
    {
       ....
       behavior: DateTimeBehavior;
    }
}

where DateTimeBehavior is just an object in
the date-time-behavior.js file:

var DateTimeBehavior =
{
   onClick: function() {....},
   onBlur: function() {....}
};


>
>> Speaking about animations as behaviors...
>> Let's assume we have some set of "standard" behaviors, then:
>>
>> Master style sheet of some UA will be able to use:
>>
>> img:animation {  behaivor: animate-image;  }
>>
>> And user will be able to define:
>>
>> img:animation {  behaivor: none;  }
>>
>> on his/her end.
>
>   Other than the fact that these behaviors are built-in rather than
> created via a binding language, this isn't functionally different from
> XBL2. I would suggest, however, that canned behaviors are better suited
> as a follow-up spec to XBL 2.0 and thus out of the scope of www-style.
>
>> But behaviors define logic of actions.
>> Animation in its turn is presentation atribute rather than
>> logic. So it is under CSS umbrella I beleive.
>
>
>  Personally, I don't see anything wrong with simple animation control
> for images, like "background-image-animation" or something. For
> instance, you may want an animated GIF to be limited to a specific frame
> range. Why is positioning and clipping of an image in space
> presentational and positioning and clipping in time behavioral? Seems a
> little arbitrary.
>

Andrew Fedoniouk.
http://terrainformatica.com

[1]  FallenGods Behavior.js : 
http://www.fallengods.com/blog/2005/07/14/js-behavior/
[2]  Ben Nolan's Behavior.js : http://www.bennolan.com/behaviour/

Received on Saturday, 9 December 2006 20:08:52 UTC