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

53strict whitespace

Expand Messages
  • Kai
    May 24, 2008
    • 0 Attachment
      Hello!

      A few -more or less- philosophical questions regarding strict whitespace option:

      A)  Comment:

      JSLint doesn't like comments within function arg parenthesis:
      function foo(bar/*,baz*/) {}

      or

      function foo(/*@cc_on  !@*/false) {}  // => Unexpected space after 'bar'.

      Why does JSLint treat this comment as space?


      B)  Space before parenthesis

      JSLint expects this:

      el.onclick = function () { //there has to be a space before parenthesis here... (1)
      function foo() {} // ...but not here (2)

      but doesn't like that:

      function
      foo () {  //=> Unexpected space after 'foo2'. (3)
      el.onclick = function() { // => Missing space after 'function'. (4)

      why is that?  just "because that's how it is" or is there a reason? shouldn't it be either with or without space?

      In
      (1), the "floating" empty parenthesis look very unusual to me. but maybe that's just because i'm used to 'bind" them to the function keyword (4)


    • Show all 2 messages in this topic