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>
<iframe></iframe>
<script>
  onload = function() {
    var win = frames[0];
    win.test = "INNER";
    window.test = "OUTER";
    win.setTimeout(function() {
       alert(this.test);
    });
  }
</script>

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

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

-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to