我有一个带有on('mouseenter')事件处理程序的元素。问题是,如果事件真正附加到元素的子节点元素的响应时间,则事件不会触发所选元素。
查询: element.tagName有时给出正确的值,有时给出错误的值,从而引发事件触发问题。
解决方案:该解决方案是添加一个带有有效标记名的数组,然后查询事件触发的元素的父元素,直到找到有效的标记名为止。
EXTJS很烦人。
var elements = Ext.select('tag1, tag2, tag3', true);
elements.on('mouseleave', function(e, el){
var tags = ['TAG1', 'TAG2', 'TAG3']; // valid event Tags in caps;
var els = el;
if(tags.includes(els)){
while(true){
els=Ext.get(els).parent("",true);
if(tags.includes(els.tagName)){break;}
}
}
// now els contains the correct tag
}, this);
// duplicate function and change event for on('mouseleave');发布于 2022-01-23 08:04:22
elements.on('mouseleave', function(e, el){
var tags = ['TAG1', 'TAG2', 'TAG3']; // valid event Tags in caps;
var els = el;
if(tags.includes(els)){
while(true){
els=Ext.get(els).parent("",true);
if(tags.includes(els.tagName)){break;}
}
}
// now els contains the correct tag
}, this);
// duplicate function and change event for on('mouseleave');https://stackoverflow.com/questions/70810786
复制相似问题