W3C home > Mailing lists > Public > www-style@w3.org > July 2003

Re: Will behaviors be added to CSS?

From: Bert Bos <bert@w3.org>
Date: Wed, 23 Jul 2003 20:13:15 +0200
Message-ID: <16158.53307.147287.104411@lanalana.inria.fr>
To: "www-style@w3.org" <www-style@w3.org>

Ian Hickson writes:
> 
> On Tue, 15 Jul 2003, Hans Meiser wrote:
> >
> > I believe Behaviors are a quite nifty feature of IE, because you can
> > dynamically create elements and define their look as well as their behavior
> > just by assigning them to the appropriate CSS class.
> 
> There is also XBL, as implemented by Mozilla, which does much the same
> thing.
> 
> > Are there any plans to add Behaviors to CSS?
> 
> At least two members of the working group are actively looking at these
> technologies, and there has been some public work on this before. However,
> I don't think there are any official plans at the moment.

I usually refer to the work on behaviors in CSS as "dormant." There is
no new draft in sight, but no formal decision to abandon it either. If
a compelling idea comes up (and somebody to champion it), it may yet
wake up.

My own feelings on behavior are mixed. I like the idea from XBL to
attach a fairly complex widget to an element, so you can make a single
element in the source have several stylable components, without
needing a full transformation language. There are some other ideas for
that in the CSS3 generated content module[1]. But though it is
interesting to be able to do that, I don't think we've seen the right
model and syntax yet. Maybe some ideas from "Frame-based layout via
Style Sheets"[2] are more promising. Although I would be even happier
if it turns out we don't need such transformations at all, because
'appearance'[3] is enough.

[1] http://www.w3.org/TR/2003/WD-css3-content-20030514
[2] http://www.w3.org/TR/NOTE-layout
[3] http://www.w3.org/TR/2003/WD-css3-ui-20030703/#appearance

I also think that some things that are called behavior are essentially
style, such as the mouse pointer shape, whether a selection is a menu
or a set of radio buttons, the color of selected text, the icon used
for drag and drop, whether a link is active or not, whether a link is
shown as a hyperlink or a transclusion, etc. In fact, with the advent
of the abstract forms language of XForms, CSS will likely have to
extend its features in that area.

What I don't like is the use of non-declarative code in various
proposals for behaviors. I don't want to execute some arbitrary Web
author's code. I'm willing to download and install a plug-in, from a
reputable source or when I get the source code with it, but I don't
consider a simple HTTP GET request enough permission to allow the
server to execute code on my machine. Javascript is always off in all
my browsers (or I use a browser that doesn't have Javascript). (That's
not just because of security, but also because so much Javascript
tries to change the behavior of my browser, which means I can't work
normally anymore. And there's no cascade in Javascript to let the user
override.)

Javascript also has the wrong model. It relies on self-modifying code,
a concept that was abandoned in the 1950's already.

Java would be more acceptable, since it runs in its own sand box and
data and doesn't mess with the document it is embedded in.

But I don't want CSS to have to rely on another language. It may well
be that behaviors are locally implemented in Javascript, but the code
that is executed should have been installed on the client beforehand.
The style sheet only identifies which code to execute. CSS can provide
common behaviors, identified by name, and the browser invokes the
appropriate routine, just as it does when you say 'display: block'.

It is likely that certain things will then not be possible with CSS.
You will maybe not be able to write a button that evades you when you
try to click it. But if you want to do UI experiments, you can always
use Java. And when the experiment is successful, there may be a
revision of CSS (or a successor of CSS) that incorporates the new
behavior.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 23 July 2003 14:13:17 GMT

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