Re: [becss] "Behavioral Extensions to CSS" computed value question

Ian Hickson wrote:
> On Thu, 25 Oct 2007, Daniel Glazman wrote:
>   
>> BTW, this raises an interesting question. Suppose we have
>>
>>   binding: url(a) url(b);
>>
>> and resource a is unparsable. What's the computed value of 'binding' ?
>>     
>
> The computed value is, as far as I can tell, fully defined in the draft 
> and does not depend on the resource itself (it can be computed without 
> hitting the network).
>
> Let me know if you believe there is a hole in the spec that I have missed, 
> so I can fix it.
>
> Cheers,
>   
Probably it is out of topic but I'll try....

Will it be possible to specify something like this in CSS:

#some-id
{
    bind: url(javascript:MyBehavior);
    // or binding: url(javascript:MyBehavior);
    // or behavior: url(javascript:MyBehavior);
    // or prototype: MyBehavior;
}

where MyBehavior is an JS object defined somewhere in script files as

var MyBehavior =
{
    onclick: function() {....},
    onmousedown: function() {....}
    // any other event handling method defined in HTML DOM
};

This way CSS can do lightweight binding of DOM elements with script 
functions without polluting HTML by @onclick, @onmouse, etc.
This approach will solve also many problems with AJAX style of content 
updating. E.g. script binding in UpdatePanels (ASP.NET) and similar 
technics.

I believe that ability to bind DOM elements with event handlers without 
need of any XML (downloading external resources, sic!) is a good thing.
I also believe that such simple binding can be implemented easily, 
uniformly and reliably in all modern UAs as it does not introduce or 
require new entities other than those already exist.

I think that for practical web application designer needs ability to 
bind element with event handlers defined in script
 #some-id
 {
    bind: url(javascript: string-to-eval);
 }
is what really needed for most *web applications*.  HTC or XBL binding 
define internal implementation details of correspondent UA vendors thus 
simply cannot be implemented uniformly across different UAs.  That is if 
to speak realistically.

Such simple thing
 #some-id
 {
    bind: url(javascript: string-to-eval);
 }
can really help to build modular and simple web applications.
I would also add include at-rule to CSS:
  @include mime-type url; 
that will allow to define script files needed for such binding.

Practically speaking,

Andrew Fedoniouk.
http://terrainfromatica.com

Received on Thursday, 25 October 2007 22:17:47 UTC