jQuery cluetip('destroy')不会破坏/删除cluetip? [英] jQuery cluetip('destroy') does not destroy/remove cluetip?

查看:68
本文介绍了jQuery cluetip('destroy')不会破坏/删除cluetip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解cluetip实际上是如何工作的。我有一个虚拟DOM结构,我做了一些警告,以检查在锚元素上调用cluetip('destroy')后是否已删除cluetip。然而,cluetip div似乎还活着。这真让我困惑......

I'm trying to make sense of how cluetip actually works. I have a dummy DOM structure which I did some alerts on to check if the cluetip has been removed after the cluetip('destroy') was called on the anchor element. However, the cluetip div still appears to be alive and well. This really confuses me...

如果我错了,请纠正我... AFAIK,cluetip在网页上有1个实例,它存在于标签层次结构中,即cluetip> cluetip-outer> cluetip-inner。当它首次被附加到一个html元素(在我的例子中,一个锚点)时,它会附加到DOM结构的某个地方。

Correct me if I'm wrong... AFAIK, cluetip has 1 instance in the webpage, and it exists in a hierarchy of tags, i.e. cluetip > cluetip-outer > cluetip-inner. It appends itself somewhere to the DOM structure when it is first appended to a html element (in my case, an anchor).

所以问题是:会调用cluetip('在html元素上的destroy')实际上删除了cluetip,或者它会删除/重置cluetip中的某种变量(如果是这样,哪个变量)?或者我完全不在这里?

So the question: would calling cluetip('destroy') on the html element actually remove the cluetip, or would it remove/reset some sort of variable in the cluetip (and if so, which variable)? Or am I totally off the track here?

谢谢。

推荐答案

看起来所有销毁功能都是删除事件触发器(第28-30行)

It looks like all the destroy function does is remove the event trigger (lines 28-30)

if (js == 'destroy') {
  return this.unbind('.cluetip');
}

如果你想确保cluetip中的数据消失,那么清除它你自己:

If you want to ensure the data in the cluetip is gone, then clear it yourself:

$('#cluetip-inner').empty();






更新:回答有关查看是否有问题的问题元素有任何约束,我会引用你从 James Padolsey的网站

// List bound events:
console.dir( jQuery('#elem').data('events') );

// Log ALL handlers for ALL events:
jQuery.each($('#elem').data('events'), function(i, event){
    jQuery.each(event, function(i, handler){
        console.log( handler.toString() );
    });
});

*注意:控制台指的是Firebug控制台。

*Note: the console is referring to the Firebug console.

这篇关于jQuery cluetip('destroy')不会破坏/删除cluetip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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