【问题标题】:How can I see what event handlers are set in js with firebug?如何查看带有 firebug 的 js 中设置了哪些事件处理程序?
【发布时间】:2021-03-01 21:48:12
【问题描述】:

一个类似的问题回答了如何在 Chrome 中执行此操作,但我有一个只能在 Firefox 中间歇性重现的错误。

具体来说,在这一行执行之后(使用hoverintent jquery plugin):

level1Items.hoverIntent(config)

有时我会得到预期的行为,有时却没有。我认为这是一个竞争条件,但这不是重点。我只想先检查是否设置了mouseovermouseout 事件,如果是,它们设置为什么。然后我可以测试事件是否按预期触发。

【问题讨论】:

  • 你的意思是 mouseover 和 mouseout 事件吗? vanilla dom javascript中没有悬停事件,尽管一些js库添加了它。

标签: javascript firefox dom-events firebug


【解决方案1】:

将此网址放在您的浏览器地址栏中,

javascript:(function(){if(typeof%20VisualEvent!='undefined'){if(document.getElementById('Event_display')){VisualEvent.fnClose();}else{VisualEvent.fnInit();}}else{var%20n=document.createElement('script');n.setAttribute('language','JavaScript');n.setAttribute('src','http://www.sprymedia.co.uk/design/event/media/js/event-loader.js');document.body.appendChild(n);}})();

javascript 格式如下:

(
    function(){
        if(typeof VisualEvent!='undefined') {
            if(document.getElementById('Event_display')){
                VisualEvent.fnClose();
            } else {
                VisualEvent.fnInit();
            }
        } else {
            var n=document.createElement('script');
            n.setAttribute('language','JavaScript');
            n.setAttribute('src','http://www.sprymedia.co.uk/design/event/media/js/event-loader.js');
            document.body.appendChild(n);
        }
    }
)();

【讨论】:

  • 你能详细说明一下这是做什么的吗?
  • 这是一个迟到的评论,但这是一个外部 javascript 库
  • 我明白这一点,但是否有任何使用它的教程或它的详细功能?我有点担心只添加这个js,它导入的js,以及js it 导入。我一直在寻找更像是一两行简单的 js 来获取事件。
  • 只需输入 console.log($("element").click);或其他事件来查看与元素关联的功能。您也可以通过记录整个元素数据来看到这一点 console.log($("#element").data());
猜你喜欢
  • 1970-01-01
  • 2014-03-09
  • 1970-01-01
  • 1970-01-01
  • 2019-02-25
  • 1970-01-01
  • 1970-01-01
  • 2021-03-25
  • 1970-01-01
相关资源
最近更新 更多