On Sep 25, 2009, at 6:22 PM, David Flanagan wrote:
Charles Jolley wrote:
Has anyone considered providing a more explicit way of testing for
this? Maybe a constant that is defined somewhere.
Strict mode isn't a global on-or-off thing. Some functions can be
strict while others aren't. So you can't capture it in a constant.
Anyway, that's what
I'm going to do:
SC.HAS_STRICT = !(function() { return this;}());
:)
If you're testing "does this browser support strict mode" then you'd
better test it in an explicitly strict context:
SC.HAS_STRICT = (function() {
"use strict";
return !(function() { return this; }());
}());
Yep, that's what M. Miller showed earlier, IIRC. Only, I don't see a
reason to double wrap.
var IS_STRICT_MODE_SUPPORTED = (function(){ "use strict"; return !
this; })();
[...]
--
kangax
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss