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

1917RE: [jslint] option.browser

Expand Messages
  • Rob Richardson
    Feb 11, 2011
      I see setTimeout (and cousins) are still in the browser defined list, but
      would you recomend the same rule of thumb be true for these? E.g. would you
      recommend "window.setTimeout( func...." rather than "setTimeout( func...."?


      -----Original Message-----
      From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
      Behalf Of douglascrockford
      Sent: Friday, February 11, 2011 8:17 AM
      To: jslint_com@yahoogroups.com
      Subject: [jslint] option.browser

      The browser predefinition list has gotten a lot shorter:

      /*global clearInterval: false, clearTimeout: false,
      document: false, event: false, frames: false,
      history: false, Image: false, location: false,
      name: false, navigator: false, Option: false,
      parent: false, screen: false, setInterval: false,
      setTimeout: false, XMLHttpRequest: false */

      The window.* methods and related properties have been removed.
      It is generally a bad idea to be poking at the window object,
      but if you must, do it explicitly. Write


      and not


      because the implicit form fails in strict mode. When a function is called as
      a function, this will be bound to undefined. In sloppy mode, this was bound
      to the global object, which was a bad idea, which enabled the implicit form,
      which was also a bad idea.
    • Show all 8 messages in this topic