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

Dean Landolt dean at deanlandolt.com
Thu Sep 9 08:46:04 PDT 2010

On Thu, Sep 9, 2010 at 10:32 AM, 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. The problem at real sites including an
> intel.com property is that subsequent parts of the concatenation have had
> strict mode errors.
> > ;/*1st lib*/"use strict";eval = 10;/*2st lib*/"use
> strict";arguments=20;/*our code*/
> An example showing the problem would need a "use nonstrict"; directive
> after the first part of the concatenation, but there is no such directive.

I recall reading that the "use strict"; directive was block-scoped. Is this
true? If so, there's no need for function wrappers -- putting each script in
its own block is easy and should have no ill effects on concatenation,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20100909/46f4df43/attachment.html>

More information about the es-discuss mailing list