Can I “step over” just jQuery code while debugging?

后端 未结 5 1006
陌清茗
陌清茗 2021-01-31 17:27

While stepping through a script that uses jQuery, I just want to test the code I wrote. I don\'t want to step into the jQuery file -- I\'m not

相关标签:
5条回答
  • 2021-01-31 18:10

    The answer is rather simple, you just have to refactor the function out. I can't recall

    $("div").each(function() {
       doThis(this);
    });
    
    function doThis(object) {
       $(this).hide();
    }
    

    Will almost certainly work with a halfway decent debugger.

    0 讨论(0)
  • 2021-01-31 18:11

    F10 should step over the function calls, F11 should step into the function calls. This works in VS as well as firebug.

    0 讨论(0)
  • 2021-01-31 18:13

    Pretty sure the answer is "no, this feature does not exist".

    What's your motivation here, though? It looks to me like setting a breakpoint on Line 2 and creating a watch for the "resultset" of Line 1 whilst you're there will get you what you're likely to want.

    0 讨论(0)
  • 2021-01-31 18:21

    Yes you can

    At least in FireFox (25+) and Chrome (30+).

    In FireFox this feature is called "Black boxing" and will be available with FireFox 25. It let's do exactly what you where looking for:

    Nick Fitzgerald and Chris Heilmann: "New Features of Firefox Developer Tools: Episode 25"

    This feature was also introduced to Chrome (v30+) although it's tougher to find/configure. It's called "skip through sources with particular names" and Collin Miller did an excellent job in describing how to configure it:

    Collin Miller: "Tips and Tricks: Ignoring library code while debugging in Chrome"

    I'm using it in Chrome right now. It works like a charm and saves me so much time.

    0 讨论(0)
  • 2021-01-31 18:32

    At least Firebug's JavaScript debugger has an option to "step over" which still does not descend into function calls.

    However, you will have to choose between "step (into)" and "step over" manually depending on what kind of function is being called.

    0 讨论(0)
提交回复
热议问题