Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Debugging in IE and Firefox... the age old question

    Ok I KNOW i should use firefox. I know that. I've been an engineer for 10 years now so its gotten ground into me. I do all my testing, all my checking in firefox because of its better error handling and its firebug extension. And all is wonderful.



    However the site I'm working must be IE7 compliant and they don't care about firefox they want it to work in IE. So at some point I need to test it in IE7. Herein lies the rub......... my app works marvelously in firefox, not at all in IE.


    When I try to run it in IE all I get is [objectError] on the screen and nothing else. IE's charming debugging tells me "Expected identifier, string or number" on line 542 of some unspecified file made up of 6 of my JS files all cobbled together.


    If the bussiness requirement is it has to work in IE I need some way to debug in IE. After I have it working in FF I need a way to find where the problems and incompatibilities are in IE. Can anyone suggest a good way of debugging through IE? I've tried the javascript:isc.showConsole() but it isn't telling me where the problem is. I haven't even seen anywhere it tells me there IS a problem.


    Can anyone offer some advice? I'd really appreciate it.

    #2
    This particular problem is probably a comma left dangling at the end of an attribute list - FF tolerates this (although it is an error), but IE does not. If you're using the SmartClient server you might well find that it's already warning you about this (in the server log). You could also try one of the JS validation websites, like this one: http://www.jslint.com.

    As for a more general debugging solution for IE, you might want to try the Aptana IDE - the Pro version of this has an IE-based debugger. I haven't used it personally, so this is not a recommendation as such - just a suggestion of one option you might like to evaluate. We also have code assist available for that IDE - check out the blog: http://blog.isomorphic.com

    Comment


      #3
      Thanks. I looked through the code but I couldnt find that type of problem. Can anyone think of another incompatibility or a way to use FF to figure out where it is?
      Thanks

      Comment


        #4
        Just about the only other possible problem is the use of "enum" or "export" as variable names or identifiers, which is illegal in IE only. For example,

        Code:
        var obj = {
           export : "foo"
        };
        .. is illegal in IE, it should be:

        Code:
        var obj = {
            "export" : "foo"
        }
        But it's much more likely that you have a dangling comma. They are not always easy to spot at a glance, hence the tools we recommended.

        Comment


          #5
          I've been trying to use JSLINT as you suggested but it's not really helping because so many things appear to be breaking. Specifically it balks on the implied globals in smartclient like isc or any of the objects I'm creating via isc. It even says alert is a global. AM I doing something wrong or is there a better validator to use?

          One of my coworkers mentioned a script he heard of that identified trailing commas but he couldn't remember what it was called. Has anyone heard of anything like that?

          Thanks
          Last edited by darkling235; 4 Aug 2008, 03:30.

          Comment


            #6
            I don't know about any script like that, but an IDE like Netbeans or Eclipse/Aptana helps in cases like this.

            You should pass your code through jslint and pay attention to what it says. Ignore the errors on the globals and fix the others. If it says "too many errors" just fix them until it finally fails because of the dangling comma.

            Comment


              #7
              Darkling,

              The script your co-worker mentioned is probably SmartClient JSSyntaxScannerFilter. This is what we meant when we suggested looking at the server log - this filter automatically flags these errors. See the Deploying SmartClient topic for details.

              Comment

              Working...
              X