W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: [WebIDL] Which realm should be used for coercing null/undefined this values to "the" global object?

From: David Bruant <bruant.d@gmail.com>
Date: Tue, 24 Sep 2013 09:31:50 +0200
Message-ID: <52413FE6.9020802@gmail.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Le 24/09/2013 02:07, Boris Zbarsky a écrit :
> On 9/23/13 5:43 PM, David Bruant wrote:
>> Maybe IE9 has a form of self-hosted addEventListener, somthing like:
>>      EventTarget.prototype.addEventListener = function(type, listener){
>>          // use |this| as an object
>>      }
>>
>> IE9 has no support for strict mode, so the code would be non-strict and
>> "this" has the global object as value by default when the function is
>> called as a function (as opposed to as a method).
>
> It has the global object as default value no matter how it's called, 
> in non-strict code.  Simple testcase:
>
> <script>
>   (function f() {alert(this);}).call(undefined);
> </script>
>
> try it in your favorite browser.
Yep, I was mistaken. My bad.

David
Received on Tuesday, 24 September 2013 07:32:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC