Debugging using inspector

Discussion in 'JavaScript' started by sarahk, Jul 4, 2021.

  1. #1
    I have a weird thing happening that I'm having problems debugging.

    I "step into next function call" through my code predictably and then I get to another script that doesn't have a line of code highlighted but at each step the "scope" changes. The callstack doesn't seem to change and I can't work out what's actually running.

    upload_2021-7-5_16-3-58.png

    I wouldn't care but one of them changes a checkbox to checked when it shouldn't be.

    Any clues on what is going on and how to see what is happening?
     
    sarahk, Jul 4, 2021 IP
  2. mmerlinn

    mmerlinn Prominent Member

    Messages:
    3,197
    Likes Received:
    819
    Best Answers:
    7
    Trophy Points:
    320
    #2
    I know nothing about the Inspector you are using, but since it seems to be impossible to step through and find the problem, you might want to do the following.

    Bracket the offending code with break points making sure the problem does not exist at the first breakpoint but does exist at the second breakpoint.

    Then do binary break points, checking each one until the problem is narrowed to the exact offensive line.

    Once you find the line, you might find the problem.

    Granted, it may be a slow process, but it is better than going nowhere like you are doing now.
     
    mmerlinn, Jul 4, 2021 IP
    Efetobor Agbontaen likes this.
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,803
    Likes Received:
    4,534
    Best Answers:
    123
    Trophy Points:
    665
    #3
    I've kind of fixed it. My onclick event called a function called "setDirty" when a value changed and while I could see the code step through that and leave successfully when I commented out the function call the problem disappeared. It's weird but I'll tackle that another day. I have bigger fish to fry right now.
     
    sarahk, Jul 7, 2021 IP