有没有办法在没有dom连接的情况下捕获自定义事件的事件冒泡。
function b() {
$(this).trigger("b");
return this
}
function a() {
this.Test = function() {
new b()
};
return this
}
var o = new a()
$(o).on("b",function(){console.log("o")})
o.Test() // no bubbling
答案 0 :(得分:0)
您需要使用Event()
对象来创建新事件:
var ev = new Event("look", {"bubbles":true, "cancelable":false});
document.dispatchEvent(ev); // the event bubbles and can't be cancelled
答案 1 :(得分:0)
这是我的解决方案,虽然我确信有更好的方法(因为我使用了不在文档上的Dom元素)
import datetime
df.loc[datetime.date(year=2014,month=1,day=1):datetime.date(year=2014,month=2,day=1)]