W3C home > Mailing lists > Public > www-svg@w3.org > June 2006

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

From: Andrew Emmons <aemmons@opentext.com>
Date: Fri, 9 Jun 2006 09:56:17 -0400
Message-ID: <BEF1FB69553AF14BBC63700F25699A1304C4D181@OTWATMX01.opentext.net>
To: <www-svg@w3.org>, <mjs@apple.com>


Hello Maciej,

Thank you very much for your comment at http://lists.w3.org/Archives/Public/www-svg/2005Dec/0245.html.

>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.


This was an unintentional error and what was meant was "global script context". Please let us know within two weeks if this does not satisfy the above comment.


>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.


We agree with you on both points and would like to update the spec accordingly. Is it possible for you to provide us a link to where the above behavior is specified? This would be very helpful.

Thanks,
Andrew, on behalf of the SVG working group

________________________________________
Andrew Emmons 
Software Architect
SVGT Player
Open Text Corporation, BitFlash Division
515 Legget Drive, Suite 300
Ottawa ON K2K 3G4

Tel: 613.599.9335 ext.3248
Fax: 613.599.9177
Web: www.bitflash.com 
www.opentext.com
________________________________________
Received on Friday, 9 June 2006 14:32:47 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:34 GMT