W3C home > Mailing lists > Public > public-webapi@w3.org > March 2006

onFoo and friends (ACTION-70)

From: Anne van Kesteren <annevk@opera.com>
Date: Tue, 28 Mar 2006 17:43:03 +0200
To: "Web APIs WG (public)" <public-webapi@w3.org>
Message-ID: <op.s64q91k464w2qv@id-c0020.oslo.opera.com>

I just finished reading the thread  
on the scope chain of onFoo events and the like. It seems that if we ever  
are going to define a specification regarding "Everything you always  
wanted to know about scripting and event handling in HTML and other  
formats but were afraid to ask 1.0" (opted by Björn in #webapi) there are  
some things that need to be defined:

  (1) At what point is `onfoo` in `<x onfoo="return false">`
      converted to an EventListener.

Some people have suggested that this should be live, e.g. doing  
`x.setAttribute("onfoo", "return true")` should update the EventListener.  
I think other people have argued for only converting it to an  
EventListener at insertion time. So everytime you do `appendChild(x)`  
where x has `x.setAttribute("onfoo","test()")` or when the document is  
first loaded. Just doing `x.setAttribute()` if x is already in the  
doucment would have no effect.

  (2) Is `onfoo` in `<x onfoo="">` and `x.onfoo` the same?

As in, does updating one update the other and vice versa?

  (3) How does `return false` or `return true` affect
      `e.preventDefault()` for various values of

  (4) Does (3) solely apply to HTML or to other languages as

  (5) How to organize the specification?

Björn suggested to make the specification generic and just state the rules  
on how languages could define onfoo attributes using the terminology  
provided in the specification. The specification would have one,  
normative, example of doing so. Namely how it applies to HTML. Of course,  
only normative for implementations that do HTML...

  (6) What to do with
      `x.removeEventListener('foo', x.onfoo, false)`?

outlines a solution to this problem although I think HTML should be  
reworded to something else, more language neutral.

  (7) What about `this`? In HTML form controls there is
      some special behavior that should be dealt with...

http://whatwg.org/specs/web-apps/current-work/#event has some information  
on the subject. (And on this subject in general.)

  (8) What about attributes that are set on some elements
      (like BODY) where the EventListener ends up
      somewhere else (like Window)?

There is probably more...

Anne van Kesteren
Received on Tuesday, 28 March 2006 15:43:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:20 UTC