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

Problems

Expand Messages
  • Jean-Charles Meyrignac
    First, could JsLint displays the number of errors and warnings, and can you add a way to configure the number of warnings ? The 50 warnings limit is really too
    Message 1 of 6 , Jun 4, 2009
    • 0 Attachment
      First, could JsLint displays the number of errors and warnings, and can you
      add a way to configure the number of warnings ?
      The 50 warnings limit is really too small.


      My first problem is a mis-detection about an unused variable:

      PageBot.prototype.locateElementByAugureExport = function(identifier,
      > inDocument, inWindow)
      > {
      > var reg=new RegExp("[;]+", "g");
      > var *arguments*=identifier.split(reg);
      > if (*arguments*.length < 2)
      > {
      > throw new SeleniumError("Unknown locator: " + identifier);
      > }
      > return LocateAugureExport(inDocument.body, *arguments*);
      > };
      >
      >
      > JsLint says:

      > 1 "locateElementByAugureExport"(identifier, inDocument, inWindow)
      >> *Unused arguments*
      >>
      >

      The second problem is when doing consecutive catch():

      function createXMLHttpRequest()
      > {
      > try { return new XMLHttpRequest();} *catch(e)*{}
      > try { return new ActiveXObject("Msxml2.XMLHTTP");} *catch(e)*{}
      > try { return new ActiveXObject("Microsoft.XMLHTTP");} *catch(e)*{}
      > try { return new ActiveXObject('Msxml2.XMLHTTP.4.0');} *catch(e)*{}
      >
      > alert("Your browser doesn't support XMLHttpRequest");
      > return null;
      > }
      >

      JsLint says:
      *Problem at line 6 character 58: 'e' is already defined.
      Problem at line 7 character 61: 'e' is already defined.
      Problem at line 8 character 62: 'e' is already defined.
      *
      JC


      [Non-text portions of this message have been removed]
    • Nagy Endre
      -. The argument inWindow isn t used anywhere inside the function. - I think the catch(e) is similar like a var e = some_error_code, the catch defines and set
      Message 2 of 6 , Jun 4, 2009
      • 0 Attachment
        -. The argument inWindow isn't used anywhere inside the function.

        - I think the catch(e) is similar like a var e = some_error_code, the catch defines and set the e variable, so using catch in the same scope with the same variable is something like using
        var e = value1;
        var e = value2;

        --- On Thu, 6/4/09, Jean-Charles Meyrignac <jcmeyrignac@...> wrote:

        From: Jean-Charles Meyrignac <jcmeyrignac@...>
        Subject: [jslint] Problems
        To: jslint_com@yahoogroups.com
        Date: Thursday, June 4, 2009, 3:47 PM

















        First, could JsLint displays the number of errors and warnings, and can you

        add a way to configure the number of warnings ?

        The 50 warnings limit is really too small.



        My first problem is a mis-detection about an unused variable:



        PageBot.prototype. locateElementByA ugureExport = function(identifier ,

        > inDocument, inWindow)

        > {

        > var reg=new RegExp("[;]+ ", "g");

        > var *arguments*= identifier. split(reg) ;

        > if (*arguments* .length < 2)

        > {

        > throw new SeleniumError( "Unknown locator: " + identifier);

        > }

        > return LocateAugureExport( inDocument. body, *arguments*) ;

        > };

        >

        >

        > JsLint says:



        > 1 "locateElementByAug ureExport" (identifier, inDocument, inWindow)

        >> *Unused arguments*

        >>

        >



        The second problem is when doing consecutive catch():



        function createXMLHttpReques t()

        > {

        > try { return new XMLHttpRequest( );} *catch(e)*{}

        > try { return new ActiveXObject( "Msxml2.XMLHTTP" );} *catch(e)*{}

        > try { return new ActiveXObject( "Microsoft. XMLHTTP") ;} *catch(e)*{}

        > try { return new ActiveXObject( 'Msxml2.XMLHTTP. 4.0');} *catch(e)*{}

        >

        > alert("Your browser doesn't support XMLHttpRequest" );

        > return null;

        > }

        >



        JsLint says:

        *Problem at line 6 character 58: 'e' is already defined.

        Problem at line 7 character 61: 'e' is already defined.

        Problem at line 8 character 62: 'e' is already defined.

        *

        JC



        [Non-text portions of this message have been removed]

















        Recent Activity


         1
        New Members









        Visit Your Group





        Search Ads
        Get new customers.
        List your web site
        in Yahoo! Search.

        Health Groups
        for people over 40
        Join people who are
        staying in shape.

        Get in Shape
        on Yahoo! Groups
        Find a buddy
        and lose weight.




        .

























        [Non-text portions of this message have been removed]
      • Jean-Charles Meyrignac
        ... Ok, it seems that arguments is a reserved word. Renaming it solves the problem. JC
        Message 3 of 6 , Jun 4, 2009
        • 0 Attachment
          On Thu, Jun 4, 2009 at 3:31 PM, Nagy Endre <forewer2000@...> wrote:
          >
          >
          > -. The argument inWindow isn't used anywhere inside the function.
          >
          Ok, it seems that arguments is a reserved word.
          Renaming it solves the problem.

          JC
        • Douglas Crockford
          ... If you fixed your code, the number of warnings would drop to zero. ... I fixed this. Thanks. It should have complained when you used arguments as a
          Message 4 of 6 , Jun 4, 2009
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, Jean-Charles Meyrignac <jcmeyrignac@...> wrote:
            >
            > First, could JsLint displays the number of errors and warnings, and can you
            > add a way to configure the number of warnings ?
            > The 50 warnings limit is really too small.

            If you fixed your code, the number of warnings would drop to zero.

            > > var *arguments*=identifier.split(reg);
            > >> *Unused arguments*

            I fixed this. Thanks. It should have complained when you used arguments as a variable.

            > The second problem is when doing consecutive catch():
            >
            > function createXMLHttpRequest()
            > > {
            > > try { return new XMLHttpRequest();} *catch(e)*{}
            > > try { return new ActiveXObject("Msxml2.XMLHTTP");} *catch(e)*{}
            > > try { return new ActiveXObject("Microsoft.XMLHTTP");} *catch(e)*{}
            > > try { return new ActiveXObject('Msxml2.XMLHTTP.4.0');} *catch(e)*{}
            > >
            > > alert("Your browser doesn't support XMLHttpRequest");
            > > return null;
            > > }

            Some browsers leak the exception variable into the function's scope so that all of those e's are actually the same variable. I recommend that you give each catch a unique variable name.
          • Arthur Blake
            ... Sometimes I JSLint code that I didn t author, but rather inherited, and it s nice to have all the warnings at once so I can fix them all in one sweep
            Message 5 of 6 , Jun 4, 2009
            • 0 Attachment
              > >The 50 warnings limit is really too small.
              > If you fixed your code, the number of warnings would drop to zero.

              Sometimes I JSLint code that I didn't author, but rather inherited,
              and it's nice to have all the warnings at once so I can fix them all
              in one sweep without having to run JSLint multiple times (especially
              when the number of warnings is in the hundreds or thousands which is
              typical with code that have never been JSLinted before)
            • benxwhite
              In some browsers the catch block has it s own scope, in others it does not... you could try this to prove... try { var x = new ActiveXObject( throw.error ); }
              Message 6 of 6 , Jun 4, 2009
              • 0 Attachment
                In some browsers the catch block has it's own scope, in others it does not...

                you could try this to prove...

                try {
                var x = new ActiveXObject('throw.error');
                } catch (e) {
                document.write(typeof e + '<br/>');
                }
                document.write(typeof e + '<br/>');


                --- In jslint_com@yahoogroups.com, Jean-Charles Meyrignac <jcmeyrignac@...> wrote:
                >
                > First, could JsLint displays the number of errors and warnings, and can you
                > add a way to configure the number of warnings ?
                > The 50 warnings limit is really too small.
                >
                >
                > My first problem is a mis-detection about an unused variable:
                >
                > PageBot.prototype.locateElementByAugureExport = function(identifier,
                > > inDocument, inWindow)
                > > {
                > > var reg=new RegExp("[;]+", "g");
                > > var *arguments*=identifier.split(reg);
                > > if (*arguments*.length < 2)
                > > {
                > > throw new SeleniumError("Unknown locator: " + identifier);
                > > }
                > > return LocateAugureExport(inDocument.body, *arguments*);
                > > };
                > >
                > >
                > > JsLint says:
                >
                > > 1 "locateElementByAugureExport"(identifier, inDocument, inWindow)
                > >> *Unused arguments*
                > >>
                > >
                >
                > The second problem is when doing consecutive catch():
                >
                > function createXMLHttpRequest()
                > > {
                > > try { return new XMLHttpRequest();} *catch(e)*{}
                > > try { return new ActiveXObject("Msxml2.XMLHTTP");} *catch(e)*{}
                > > try { return new ActiveXObject("Microsoft.XMLHTTP");} *catch(e)*{}
                > > try { return new ActiveXObject('Msxml2.XMLHTTP.4.0');} *catch(e)*{}
                > >
                > > alert("Your browser doesn't support XMLHttpRequest");
                > > return null;
                > > }
                > >
                >
                > JsLint says:
                > *Problem at line 6 character 58: 'e' is already defined.
                > Problem at line 7 character 61: 'e' is already defined.
                > Problem at line 8 character 62: 'e' is already defined.
                > *
                > JC
                >
                >
                > [Non-text portions of this message have been removed]
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.