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

Re: Another view (sorry) on XBL and behaviours

From: David Hyatt <hyatt@apple.com>
Date: Mon, 6 Jan 2003 11:25:06 -0800
Cc: Andrew Clover <and@doxdesk.com>, www-style@w3.org
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Message-Id: <8FD95031-21AC-11D7-BFB7-00039382AC6C@apple.com>

On Monday, January 6, 2003, at 08:57 AM, Boris Zbarsky wrote:

>
>> XBL files (as HTCs in IE) provide a layer of encapsulation that may be
>> useful to some programmers. However, they do not themselves provide 
>> any
>> real extra functionality; everything that can be done with them could 
>> be
>> done with a little extra inconvenience using plain 
>> [Java|J|ECMA]Script,
>> coupled with DOM Level 2 Events.
>
> This is not quite true.  One difference that Ian has pointed out, for 
> example,
> is the ability for the user to override specific behaviors.  This 
> ability is
> provided by the encapsulation of behaviors into an external resource 
> (an XBL
> binding, eg) which is then somehow attached to an element.  This means 
> that
> overriding the behavior merely involves severing that attachment.
>
> I do not see a good way for the user to override a web page's 
> scripting of
> <select> elements and nothing else if the script is just dumped into a 
> <script>
> tag on the page -- there is no way to tell which parts of the script 
> are
> relevant to <select> elements and which are not.
>

Yes, I think this is a key point that people have been missing.  XBL 
provides a clean way to separate the "built-in" behavior/functionality 
of your widget from code that uses that widget.  XBL cleanly 
encapsulates your widget's functionality so that it can be reused 
across multiple Web pages,   Alternate stylesheets even allow you to 
provide multiple presentations for your widget and switch between them.
The CSS selector mechanism allows you to dynamically change complex 
presentations on the fly just by attaching a different binding.

All other solutions that I've heard involve polluting the main document 
with these built-in event handlers and behaviors.  For example, how 
would you handle easily defining multiple complex presentations and 
switching between them without leveraging alternate stylesheets?  Think 
about how much extra code that would be.

dave
Received on Monday, 6 January 2003 14:26:06 GMT

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