"use strict" VS setTimeout

Boris Zbarsky bzbarsky at mit.edu
Sun Sep 7 18:55:19 PDT 2014

On 9/7/14, 9:35 PM, Boris Zbarsky wrote:
> Now, and here's where I have a problem with your use of "the": the
> Window that setTimeout is invoked on is NOT necessarily the same as the
> global object of the function.

Just to make this concrete, see 
http://fiddle.jshell.net/tmt5e9m6/2/show/ which has pretty much the 
following source, for posterity:

<!DOCTYPE html>
   onload = function() {
     var win = frames[0];
     win.test = "INNER";
     window.test = "OUTER";
     win.setTimeout(function() {

As far as I can tell, this alerts "INNER" in IE 10 or later, Firefox 2 
or later (and probably earlier; I don't have earlier versions on hand 
right this second), Chrome 14 or later (and likely earlier; once again I 
have no earlier versions on hand), Safari 4 or later (and again likely 

IE6 through IE9 alert "OUTER", for what it's worth.


More information about the es-discuss mailing list