Re: Handling of script attributes (was Re: HTML 4.0 draft available)

Dave Raggett (dsr@w3.org)
Thu, 10 Jul 1997 06:57:00 -0400 ()


Date: Thu, 10 Jul 1997 06:57:00 -0400 ()
From: Dave Raggett <dsr@w3.org>
To: Scott Matthewman <scottm@danielson.co.uk>
cc: www-html@w3.org, Jordan Reiter <jreiter@mail.slc.edu>
Subject: Re: Handling of script attributes (was Re: HTML 4.0 draft available)
In-Reply-To: <19970709080343421.AAA261@scott.danielson.co.uk>
Message-ID: <Pine.WNT.3.95.970710064246.-185917G-100000@hazel.w3.org>

On Wed, 9 Jul 1997, Scott Matthewman wrote:

> I do think, though, that the insertion of script events into tags
> should be discouraged more firmly, to be replaced by binding from
> a script in the <HEAD> element. Individual event attributes in
> tags should be deprecated, to be replaced by a SCRIPT attribute,
> in much the same way as the STYLE attribute can incorporate style
> changes. 

The idea of a generic SCRIPT attribute was proposed a while back.
It would have to allow for binding multiple events to handlers,
since SGML doesn't allow you to have more than one occurrence of
the same attribute in any given element. Another idea was to use
an element to bind each event to a handler. This was rejected
in favor of the explicit event attributes (simpler and already
deployed). Some people suggested the goal of being able to
provide editing enviroments for scripting that could track which
handlers are used for which events, with out the need to understand
the scripting language.

Conceptually having an explicit list of events may make it easier
to achieve interoperability by forcing us to define an language
and platform neutral model for events. This is being done in the
W3C Document Object Model working group.

> Would this go any way to meeting your reservations? What it would
> then be doing would essentially split a fully-laden HTML document
> into three distinct sections: 
> 
> 1) Main document, including text, graphics and hyperlinks
> 2) Style sheet, governing presentational output
> 3) Script, governing interactivity.

Styles are easier to share across pages. Scripts tend to be
more specific to the particular page design. This encourages
designers to place script statements in the page. The combination
of onclick etc. attributes, script elements and linked scripts
allows for an effective choice of where to place script statements
facilitating the adoption a clean coding style. Bad programmers
will always write messy programs though ...

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
phone: +44 122 578 2521 (office) +44 385 320 444 (gsm mobile)
World Wide Web Consortium (on assignment from HP Labs)