console.trace或stack trace to pinpiont javascript中的bug的来源? [英] console.trace or stack trace to pinpiont the source of a bug in javascript?

查看:107
本文介绍了console.trace或stack trace to pinpiont javascript中的bug的来源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了一些复杂的javascript(jQuery)来创建各种编辑器,用户可以拖放,调整不同的 div 。问题在于,有时候,由于看似没有理由,包含文本的div突然被冻结或卡住在包含div上并且无法被拖动,尽管仍然保持包含 ui-的类列表在我提到之后,可拖动

I've used some complex javascript (jQuery) to create an editor of sorts where users can drag, drop and resize different divs. The problem is that sometimes, for seemingly no reason, divs that contain text suddenly get "frozen" or "stuck" on the containing div and cannot be dragged around, despite still maintaining a class list that includes ui-draggable, right after I mention:

$this.draggable( "option", "disabled", false );

因此从技术上讲,没有理由拖延拖延。我使用Ctrl + Shift + K来使用firebug的web控制台但是当我拖动它时不会触发控制台上的任何东西,以及我无法拖动一个特定的事实没有显示任何东西。我尝试过分析,但这些东西只是说明在某个脚本上花了多少时间。我怎么可能弄清楚为什么元素的拖动才会被关闭而无法再次打开?我不能提出断点,因为我不知道代码中哪些地方出了问题。它几乎是武断的。有没有办法只是实时查看堆栈中发生的事情?

So technically there's no reason why the dragging should stop. I used Ctrl+Shift+K to use the web console of firebug but when I drag things around that doesn't trigger anything on the console, and the fact that I can't drag one particular around also doesn't show anything up. I've tried profiling but these things just tell how much time is spent in a certain script. How can I possibly figure out why an element's drag just gets turned off and cannot be turned on again? I can't put breakpoints because I don't know where in the code something's going wrong. It almost seems arbitrary. Is there any way to to simply see what's happening on the stack in realtime?

在Firebug中我们可以看到一个对象的完整属性列表,远远超过下面这个小截图中的内容。有没有人知道我应该关注哪些对象属性,这与我的问题有关?我真的迷失了如何诊断问题。

In Firebug we can see an entire list of properties for an object, much more than what fits in this little screenshot below. Does anyone have any idea which object properties I should concerned with, that pertain to an issue like mine? I'm really lost on how to diagnose the problem.

推荐答案

@Allendar - 确实存在太多绑定问题。我跟进了这个问题:我在这个jQuery代码中一遍又一遍地绑定事件吗?并在视觉事件,我摆脱了我一遍又一遍地做的绑定,然后它运行良好。

@Allendar - too many bindings was indeed the issue. I followed up with this question: Am I binding events over and over again in this jQuery code? and with the help of Visual Event, I got rid of bindings that I was doing over and over again, and then it worked fine.

这篇关于console.trace或stack trace to pinpiont javascript中的bug的来源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆