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

Liam Quinn (liam@htmlhelp.com)
Wed, 09 Jul 1997 22:18:17 -0400


Message-Id: <3.0.2.32.19970709221817.008823a0@undergrad.math.uwaterloo.ca>
Date: Wed, 09 Jul 1997 22:18:17 -0400
To: MegaZone <megazone@livingston.com>, www-html@w3.org
From: Liam Quinn <liam@htmlhelp.com>
Subject: Re: Handling of script attributes (was Re: HTML 4.0 draft
In-Reply-To: <199707092336.QAA17133@eve.livingston.com>

-----BEGIN PGP SIGNED MESSAGE-----

At 04:36 PM 09/07/97 -0700, MegaZone wrote:
>Once upon a time Scott Matthewman shaped the electrons to say...
>>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.
>
>You must have a way to bind event handlers to elements - no way around 
that.
>All the event handlers define are the crossover points between HTML and 
the
>scripting language.  Note that the language itself is NOT defined - only
>the event handlers.

But many of the event handlers are media-specific, which is unnecessary as 
well as inconsistent with the overall message of HTML 4.0.  There should 
be ways to provide event handlers inline, embedded, or externally, just as 
with style sheets.  Inline, a more generic attribute like SCRIPT (or 
perhaps EVENT) would be consistent with the style sheet approach, and 
would allow new, language-dependent event handlers to be developed without 
having to update HTML standards.  The syntax of the SCRIPT value would be 
language-dependent, but I could imagine something like the following:

<INPUT TYPE=text NAME=email SCRIPT="onChange: validate(this); onFocus: 
tip('e.g., liam@htmlhelp.com');">

or perhaps

<INPUT TYPE=text NAME=email SCRIPT="onChange { validate(this); } onFocus { 
tip('e.g., liam@htmlhelp.com'); }">

For embedded or external scripts, the event handlers would be better 
defined in the scripts themselves, allowing authors to apply scripts to 
multiple pages without having to add attributes like onClick, whose media 
dependencies should make them deprecated in HTML 4.0.

>You can inline scripts, sure - you can also inline style sheets.

But more often than not an external style sheet makes more sense.  Inline 
styles are not often appropriate, especially since they implicitly apply 
to all media.

>Note that you can already 
>use the SRC attribute on a SCRIPT element to call an external script.

This syntax makes little sense given the following alternative:

<LINK REL=Script HREF="yourscript.js" TYPE="text/javascript" TITLE="Form 
validation">

The use of an empty element seems much more sensible than a container for 
external scripts.

>Sure it will be abused - but making the rules tighter will not stop that, 
and
>will only hamper those who want to do decent work.

A lot of people avoid using client-side scripting because of the enormous 
number of bugs and inconsistencies across browsers.  Now would be a good 
time to decide on a better way of providing scripting hooks in HTML.  New 
methods, unsupported by the old, buggy browsers, will allow authors to use 
scripts with worrying about being bitten by bugs (until browsers actually 
start supporting HTML 4.0 :)).

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQB1AwUBM8RGaA/JhtXygIx1AQEh5QL/bU9fkVCc0kQq6YR029yXCMg1wSZbO9h5
dzZP+kSIFCDFRf6ImBzPhlJcfw9a4tYspCwi+yzp3u6otVr3lFVMmZJ2TD5X2wQJ
EuGw7qDAkpWEVlLoSnwsLEWO9DK6ZdI2
=9iYW
-----END PGP SIGNATURE-----

Liam Quinn
===============  http://www.htmlhelp.com/%7Eliam/  ===============
Web Design Group            Enhanced Designs, Web Site Development
http://www.htmlhelp.com/    http://enhanced-designs.com/
======  PGP Key at http://www.htmlhelp.com/%7Eliam/pgp.html  =====