W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2000

Re: DOM 2 Event question...

From: Glenn Adams <gadams@vgi.com>
Date: Thu, 22 Jun 2000 11:08:02 -0700
Message-ID: <003901bfdc75$0d303250$47070001@vgi.com>
To: <Sam.Christiansen@trilogy.com>
Cc: <www-dom@w3.org>
My reading of this text, to use your example, is that:

buttonElt.setAttribute ( "onclick", "alert('foo')" );

can be implemented as (assuming that buttonElt instanceof EventTarget ==

buttonElt.addEventListener ( "click", new Function ( "e",
"alert('foo')" ), false );

However, this seems problematic to me: if an implementation is free to
implement setAttribute in this manner, then would this support standard
attribute semantics; i.e., what would getAttribute() return after

Or does this text say "in addition to setting an attribute recognized to
represent an event handler, that implementors may/should/must (?) *also*
create and register an equivalent EventListener on the node"?

Glenn Adams

----- Original Message -----
From: <Sam.Christiansen@trilogy.com>
To: <www-dom@w3.org>
Sent: Thursday, June 22, 2000 8:52 AM
Subject: DOM 2 Event question...

> In mainting compatibility with HTML 4.0 event listeners, the spec
> "In order to achieve compatibility with HTML 4.0, implementors may
view the
> settings of attributes which represent event handlers as the creation
> registration of an EventListener on the Node.  The value of useCapture
> defaults to false.  This EventListener behaves in the same manner as
> other EventListeners which may be registered on the EventTarget."
> If the EventListener behaves in the same manner as any other
> then is the attribute which represents the event handler expected to
> to an object inmplementing the EventTarget interface (as opposed to a
> function)?
> ie, in HTML 4.0, I just put:  <BUTTON onclick="alert('foo')">
> with the new DOM 2 spec, would it look something like this?
> <BUTTON onclick="myEventHandler">
> where 'myEventHandler' implements the event target interface?  This
> backwards compatibility, and I just want to make sure that I
understand the
> spec correctly.
> Thanks,
> Sam Christiansen
> Trilogy Software
Received on Thursday, 22 June 2000 14:03:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC