Yes Axel, that's how it works, this will show undefined indeed all over ```js (function () { 'use strict'; function g() { console.log(this); } g(); // undefined setTimeout(function () { g(); // undefined }, 0); }()); ```
or testing other use strict restrictions: ```js (function () { 'use strict'; setTimeout(function () { argument.callee }, 0); }()); ``` The strict behavior is preserved, it's not an opt-out, but the invoked function within setTimeout has the global context regardless it has been defined under the strict directive + regardless it defines itself as strict. Basically if you feel secure about "use strict" here you have a case that shows you shouldn't ... making one point of strict directive kinda broken/pointless. Regards On Sun, Sep 7, 2014 at 7:02 PM, Axel Rauschmayer <a...@rauschma.de> wrote: > On Sep 7, 2014, at 19:47 , Mark S. Miller <erig...@google.com> wrote: > > On Sun, Sep 7, 2014 at 10:36 AM, Mathias Bynens <mathi...@opera.com> > wrote: > >> On Sun, Sep 7, 2014 at 7:29 PM, Andrea Giammarchi >> <andrea.giammar...@gmail.com> wrote: >> > This looks like a potential problem when possible passed methods are not >> > bound + it looks inconsistent with *"use strict"* expectations. >> > > Yes. This looks like a typical screwup. Thanks for pointing it out. > > > Interesting. Follow-up question: isn’t strictness propagated lexically? > That is, shouldn’t the parameter of `setTimeout()` be strict even without > being explicitly declared as such? > > -- > Dr. Axel Rauschmayer > a...@rauschma.de > rauschma.de > > > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss