onFoo and friends (ACTION-70)

I just finished reading the thread  
http://lists.w3.org/Archives/Public/public-webapi/2006Mar/thread.html#msg131  
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
      `e.type`?

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

  (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)`?

http://www.w3.org/mid/191127F9-AB91-482C-A141-6994322D7749@apple.com  
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
<http://annevankesteren.nl/>
<http://www.opera.com/>

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