Re: Future suggestions for stylesheets ...

Tim Bagot <tsb-w3-style-0003@earth.li> wrote:

> There was a Behavioral CSS (BeCSS) WD, but it seems to have been
> more or less abandoned.

I do hope so.

> I think it is felt that scripting should be kept out of the core
> specification, as it adds too much complexity.

Not to mention possible security problems. The world does not need
another unexpected place to hide scripting: just look at the
problems javascript: URLs have caused.

> could similar functionality be achieved by a script traversing
> the document tree and adding event attributes as required?

Yes, I've written several scripts this way and it's quite pleasant.
body-onload calls an initialisation function in a linked script,
which binds onto the required elements with no extra markup
required. It'll be better when more browsers support DOM 2 Events
and methods like 'addEventListener', which have the potential to
cope better with multiple behaviours.

The big problem is picking out which elements to affect. Selecting
a single element is fine (getElementById, with backup for older
browsers); selecting all elements of a certain type is okay
(getElementsByTagName, backup for older browsers is tricky);
selecting all elements of a certain class is not easy at all. The
DOM lacks a getElementsByArbitraryAttributeValue().

-- 
Andrew Clover
Technical Consultant
1VALUE.com AG

Received on Monday, 16 July 2001 06:58:13 UTC