在使用0.7.4版本 (也是0.7.1)的 sammy.js 库时,发现如果在处理函数执行期间发生某些错误,则不会将任何内容打印到控制台。get
例如,在以下代码片段中,尽管不notExistingFunction
存在具有名称的函数,但不会将任何内容打印到控制台:
<html>
<head>
...
<script src="/path/to/jquery-1.5.2.min.js"></script>
<script src="/path/to/sammy-0.7.4.min.js"></script>
...
</head>
<body>
<script>
$(document).ready(function() {
var sammy = Sammy(function() {
this.get('#someAnchor', function() {
// this function doesn't exist
notExistingFunction();
});
});
sammy.run();
// this should lead to execution of above handler
window.location.hash = '#someAnchor';
});
</script>
...
</body>
</html>
这确实使页面的故障排除变得复杂,有人也遇到过这种情况吗?这是预期的行为还是错误?有什么解决方法吗?
非常感谢提前