Javascript breakpoints not being respected in certain cases?
Hi everyone,
I've downloaded WebStorm 1.0 and have been having trouble with some breakpoints set in a javascript file. As an overview, I have an html page that includes two <script> src tags-- one for a minified version of jQuery, the other for test.js, which holds a function I'm testing.
Here's the content of test.js:
$(document).ready(function() {
$('input[id$=btnSort]').click(function(e) {
e.preventDefault();
var sortedDdl =
$.makeArray($('select[id$=DDL] option'))
.sort(function(o, n) {
return $(o).text() < $(n).text() ? -1 : 1;
});
$("select[id$=DDL]").html(sortedDdl).val("1");
$("#para").html("Items were Sorted!");
$(this).attr("disabled", "disabled");
});
});
If I set a breakpoint on any line in there, it's never hit during a WebStorm debugging session. The click() function _is_called however, as the <select> list is sorted in the way the function describes whenever the sort button on my page is pressed.
I'm able to set and use javascript breakpoints in other js files in my project, but for whatever reason this function isn't triggering a break when I debug. I'm not sure why and would be interested in knowing what I can try. Thanks!
请先登录再写评论。
The problem doesn't reproduce for me. Which OS/Firefox version do you have?
I used the following html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="test.js"></script>
</head>
<body>
<input id="btnSort" type="button"/>
<br>
<select id="DDL">
<option>3</option>
<option>2</option>
<option>1</option>
</select>
</body>
</html>
Strange....breakpoints in this function are now working, after I closed the IDE and restarted it. Not sure what happened, but most likely operator error of some sort. Nikolay, thanks for the second pair of eyes on this.
-Jim
(Oh, and before I forget, I was using FireFox 3.6.3)