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

Re: /*properties*/ and /*global*/ now respect function scope

Expand Messages
  • jeddahbill
    ... The new implementation of /*properties*/ is causing problems. Consider the following code: (function () { ````var x; ````x = { ````````fa: function (arg) {
    Message 1 of 4 , Mar 6, 2011
      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      > The /*properties*/ (formerly known as /*members*/) and the /*global*/ directives, when placed in a function, do not influence the environment outside of the function.
      >
      > So in this example, function a gets no warnings, but function b does.
      >
      >
      > ````function a(x) {
      > ````````/*global window*/
      > ````````/*properties location, href*/
      > ````````window.location.href = x;
      > ````}
      > ````
      > ````function b(x) {
      > ````````window.location.href = x;
      > ````}
      >

      The new implementation of /*properties*/ is causing problems.
      Consider the following code:

      (function () {
      ````var x;
      ````x = {
      ````````fa: function (arg) {
      ````````````return arg * arg;
      ````````}
      ````};
      }());

      ...for which jslint produces this error:

      Problem at line 6 character 9: Unexpected property 'fa'.

      I did not define /*properties*/ - at any scope - and, therefore, did not expect to be presented with a 'properties' error;
    • Douglas Crockford
      ... Sorry about that. I was finishing this in an airport, and I rushed the push to make a flight. Please try it now.
      Message 2 of 4 , Mar 7, 2011
        --- In jslint_com@yahoogroups.com, "jeddahbill" <jeddahbill@...> wrote:
        > The new implementation of /*properties*/ is causing problems.

        Sorry about that. I was finishing this in an airport, and I rushed the push to make a flight. Please try it now.
      • jeddahbill
        ... Thank you!
        Message 3 of 4 , Mar 7, 2011
          --- In jslint_com@yahoogroups.com, "jeddahbill" <jeddahbill@...> wrote:
          >
          >
          >
          > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
          > >
          > > The /*properties*/ (formerly known as /*members*/) and the /*global*/ directives, when placed in a function, do not influence the environment outside of the function.
          > >
          > > So in this example, function a gets no warnings, but function b does.
          > >
          > >
          > > ````function a(x) {
          > > ````````/*global window*/
          > > ````````/*properties location, href*/
          > > ````````window.location.href = x;
          > > ````}
          > > ````
          > > ````function b(x) {
          > > ````````window.location.href = x;
          > > ````}
          > >
          >
          > The new implementation of /*properties*/ is causing problems.
          > Consider the following code:
          >
          > (function () {
          > ````var x;
          > ````x = {
          > ````````fa: function (arg) {
          > ````````````return arg * arg;
          > ````````}
          > ````};
          > }());
          >
          > ...for which jslint produces this error:
          >
          > Problem at line 6 character 9: Unexpected property 'fa'.
          >
          > I did not define /*properties*/ - at any scope - and, therefore, did not expect to be presented with a 'properties' error;
          >

          Thank you!
        Your message has been successfully submitted and would be delivered to recipients shortly.