"use strict"; prepended blindly to scripts in the wild

Brendan Eich brendan at mozilla.com
Thu Sep 9 10:35:31 PDT 2010


On Sep 9, 2010, at 10:33 AM, Dmitry Soshnikov wrote:

> On Thu, Sep 9, 2010 at 6:32 PM, Brendan Eich <brendan at mozilla.com> wrote:
> On Sep 9, 2010, at 1:09 AM, Dmitry Soshnikov wrote:
> 
> > Thus the site's combined file won't be globally strict, however since a lib is tested before a production release (at least I hope so ;), then the lib's code should pass the strictness, and therefore, a "use strict" may be even removed from the lib's file. However, if not to remove, then an empty statement is enough.
> 
> That does not disable strict mode.
> 
> 
> Actually it does (since a strict mode, and the directive prologue is an initial statement):
> 
> "use strict";eval=10 // strict, error
> 
> but
> 
> ;"use strict";eval = 10; // non-strict, OK 

Oh, I see -- that solves the problem of strict mode in the second or later parts of the concatenation.

But the problem that's already come up on the web has strict mode enabled in the first part, which complies with strict mode, but later parts do not -- and there's no way to disable for them.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20100909/2b7e0804/attachment.html>


More information about the es-discuss mailing list