SVGT 1.2: <handler> script scope and `this' object

The SVG 1.2 Tiny spec says:

"Event listeners attached through event attributes and handler  
elements are also evaluated using the global scope of the document in  
which they are defined."

This has a few issues:

1) Contradiction: the description of the <handler> element says that  
the contents of the handler behave as if they are the contents of a  
new function body, but functions in ECMAScript have their own scope  
and do not execute at global scope. This makes a difference for  
example in the processing of "var" declarations. At global scope they  
would declare global variables, at function scope they would declare  
variables local to the function. Please resolve the contradiction.

2) Event listeners attached via addEventListener or via event handler  
attributes run with this "this" object bound to the EventTarget to  
which they are attached (the "observer" in XML Events parlance). This  
is extremely useful behavior. The SVGT 1.2 spec does not make clear  
whether this happens or not. It doesn't say whether the function  
created from a <handler> body is attached with addEventListener, or  
acts as if it had been. Please specify that the function object  
created from a <handler> acts as if attached in this way.

3) Event listeners attached via event handler attributes (at least in  
html) run with the element to which they are attached (the observer,  
effectively) pushed into the scope chain. This is extremely useful  
and makes it easy to write quick inline scripts. SVGT 1.2 should  
specify this behavior for <handler> as well for ease of use and  
consistency.

Regards,
Maciej

Received on Wednesday, 28 December 2005 12:10:55 UTC