Loading ...
Sorry, an error occurred while loading the content.

RE: [jslint] option.strict

Expand Messages
  • Rob Richardson
    You ve specified at the top of the file twice. Did you intend to identify the second as the top of a function ? Rob ... From: jslint_com@yahoogroups.com
    Message 1 of 9 , Dec 13, 2010
    • 0 Attachment
      You've specified "at the top of the file" twice. Did you intend to identify
      the second as "the top of a function"?

      Rob


      -----Original Message-----
      From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
      Behalf Of Douglas Crockford
      Sent: Monday, December 13, 2010 3:54 PM
      To: jslint_com@yahoogroups.com
      Subject: [jslint] option.strict

      Some famous websites are failing on the latest browsers because they have
      been concatenating strict mode scripts with non-strict mode scripts. This
      causes the non-strict scripts to fail.

      There are two ways to specify strict mode. The first is to place "use
      strict"; at the top of the file. This contributes to the comcatenation
      failure. The second is to place "use strict"; at the top of a file. This
      gives the strictness function scope, which is much more reliable.

      JSLint's option.strict now accepts the second form. Soon it will reject the
      first form.
    • Douglas Crockford
      ... Yes.
      Message 2 of 9 , Dec 13, 2010
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Rob Richardson" <erobrich@...> wrote:
        >
        > You've specified "at the top of the file" twice. Did you intend to identify
        > the second as "the top of a function"?

        Yes.
      • AJ ONeal
        FYI, at the top of means inside , not on top . That s why I was originally confused. // Non-strict code... (function(){ use strict ; // Define your
        Message 3 of 9 , Dec 13, 2010
        • 0 Attachment
          FYI, "at the top of" means "inside", not "on top".
          That's why I was originally confused.

          // Non-strict code...

          (function(){
          "use strict";

          // Define your library strictly...
          })();

          // Non-strict code...


          http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it


          I believe this would be a useless statement (though I'm not sure).
          In any case it's probably best to avoid it.


          (function(){

          // do stuff
          }());

          "use strict";

          (function(){

          // do stuff
          })();


          AJ ONeal


          On Mon, Dec 13, 2010 at 4:26 PM, Douglas Crockford <douglas@...>wrote:

          >
          >
          > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
          > Richardson" <erobrich@...> wrote:
          > >
          > > You've specified "at the top of the file" twice. Did you intend to
          > identify
          > > the second as "the top of a function"?
          >
          > Yes.
          >
          >
          >


          [Non-text portions of this message have been removed]
        • Jakob Kruse
          In your second example, use strict ; is neither at the top of a file or at the top of a function, thus it has no effect. /Jakob _____ From: AJ ONeal
          Message 4 of 9 , Dec 14, 2010
          • 0 Attachment
            In your second example, "use strict"; is neither at the top of a file or at the top of a function, thus it has no effect.


            /Jakob

            _____

            From: AJ ONeal [mailto:coolaj86@...]
            To: jslint_com@yahoogroups.com
            Sent: Tue, 14 Dec 2010 00:36:05 +0100
            Subject: Re: [jslint] option.strict

            FYI, "at the top of" means "inside", not "on top".
            That's why I was originally confused.

            // Non-strict code...

            (function(){
            "use strict";

            // Define your library strictly...
            })();

            // Non-strict code...


            http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it


            I believe this would be a useless statement (though I'm not sure).
            In any case it's probably best to avoid it.


            (function(){

            // do stuff
            }());

            "use strict";

            (function(){

            // do stuff
            })();


            AJ ONeal


            On Mon, Dec 13, 2010 at 4:26 PM, Douglas Crockford <douglas@...>wrote:

            >
            >
            > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
            > Richardson" <erobrich@...> wrote:
            > >
            > > You've specified "at the top of the file" twice. Did you intend to
            > identify
            > > the second as "the top of a function"?
            >
            > Yes.
            >
            >
            >


            [Non-text portions of this message have been removed]



            ------------------------------------

            Yahoo! Groups Links





            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.