I added a breakpoint for the following code on line 44 of the debugger; . I expected chrome to stop there every time before console.log("...") executed. But, to my surprise, he stops only once.
To check an example:
- Run the snippet below in Chrome
- Open Chrome Dev Tools
- Drag an image from another website to the drag area
At this point, chrome stops at the breakpoint. But if you look in the console, you will see that the console.log statement was executed two more times.
I would like to know why this is happening. (Threading issue?)
And how can I solve this if I want to debug the code in this line.
$(document).ready(function() { $('#drop-area').on("dragover", function(event) { event.preventDefault(); event.stopPropagation(); $(this).addClass('dragging'); }); $('#drop-area').on("dragleave", function(event) { event.preventDefault(); event.stopPropagation(); $(this).removeClass('dragging'); }); $('#drop-area').on("drop", function(event) { event.preventDefault(); event.stopPropagation(); var count = 1; var dropObj = event.originalEvent.dataTransfer; for (var i = 0; i < dropObj.items.length; i++) { var aDropItm = dropObj.items[i]; if (aDropItm.kind == "file") {
#drop-area { background-color: red; width: 400px; height: 400px; }
<div id="drop-area">Drop files here...</div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
EDIT
I reported this as an error: https://bugs.chromium.org/p/chromium/issues/detail?id=748923
javascript debugging google-chrome google-chrome-devtools
Lars
source share