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

Re: [jslint] Re: Unused Variables

Expand Messages
  • Morgaut Alexandre Louis Marc
    ... So new XMLHttpRequest( POST , /log ).send(logText); should be ok ;-) The message returned by JSLint otherwise is: Do not use ‘new’ for side
    Message 1 of 5 , Apr 4, 2011
    • 0 Attachment
      On 4 avr. 2011, at 19:14, Douglas Crockford wrote:
      > new should only be used to create objects, so
      >
      > new Stupid;
      >
      > should produce a warning.
      >
      > It is ok to use new and then use its result immediately.
      >
      > new Thing().exec();
      >

      So

      new XMLHttpRequest('POST', '/log').send(logText);

      should be ok ;-)

      The message returned by JSLint otherwise is: "Do not use �new� for side effects."

      Does that mean that widget constructors should in theory only create a reference to a widget, which would be then:
      - added to the DOM
      - or applied on a DOM Element
      through one of its methods ?

      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... It works for me. What are you using?
      Message 2 of 5 , Apr 4, 2011
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, Morgaut Alexandre Louis Marc <morgaut@...> wrote:
        > So
        >
        > new XMLHttpRequest('POST', '/log').send(logText);
        >
        > should be ok ;-)

        It works for me. What are you using?
      • Morgaut Alexandre Louis Marc
        ... It works for me also Sorry if it looked like I meant it didn t work My purpose was more about a common case in libraries and frameworks where new
        Message 3 of 5 , Apr 4, 2011
        • 0 Attachment
          On 5 avr. 2011, at 07:59, Douglas Crockford wrote:
          > --- In jslint_com@yahoogroups.com, Morgaut Alexandre Louis Marc <morgaut@...> wrote:
          > > So
          > >
          > > new XMLHttpRequest('POST', '/log').send(logText);
          > >
          > > should be ok ;-)
          >
          > It works for me. What are you using?
          >


          It works for me also
          Sorry if it looked like I meant it didn't work

          My purpose was more about a common case in libraries and frameworks where

          new AwesomeWidget();

          directly create and render a widget

          If I don't misinterpret the design guideline, they should better, be usable this way:

          new AwesomeWidget().render();



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