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

incorrect error about missing space after '['

Expand Messages
  • neonstalwart
    i have found a bug. when running the following code through JSLint, it gives me the error below. /*global define: false */ /*jslint newcap: true, onevar:
    Message 1 of 2 , Nov 9, 2010
    • 0 Attachment
      i have found a bug. when running the following code through JSLint, it gives me the error below.

      /*global
      define: false
      */
      /*jslint
      newcap: true,
      onevar: true,
      white: true
      */

      define(['foo'], function (f) {
      var attr = 'data-bar';

      return f.declare([null], {
      getList: function (e) {
      return f.query('['+ attr + ']', e.target);
      }
      });
      });


      Error:
      Problem at line 15 character 34: Missing space after '['.

      return f.query('['+ attr + ']', e.target);


      i don't need to have a space after the '[' and in fact, in my use case, i need to *not* have a space after the '['.

      thanks,

      ben...
    • pauanyu
      Why wouldn t this work? return f.query( [ + attr + ] , e.target);
      Message 2 of 2 , Nov 11, 2010
      • 0 Attachment
        Why wouldn't this work?

        return f.query('[' + attr + ']', e.target);

        --- In jslint_com@yahoogroups.com, "neonstalwart" <neonstalwart@...> wrote:
        >
        > i have found a bug. when running the following code through JSLint, it gives me the error below.
        >
        > /*global
        > define: false
        > */
        > /*jslint
        > newcap: true,
        > onevar: true,
        > white: true
        > */
        >
        > define(['foo'], function (f) {
        > var attr = 'data-bar';
        >
        > return f.declare([null], {
        > getList: function (e) {
        > return f.query('['+ attr + ']', e.target);
        > }
        > });
        > });
        >
        >
        > Error:
        > Problem at line 15 character 34: Missing space after '['.
        >
        > return f.query('['+ attr + ']', e.target);
        >
        >
        > i don't need to have a space after the '[' and in fact, in my use case, i need to *not* have a space after the '['.
        >
        > thanks,
        >
        > ben...
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.