几分钟前,我回答了这个问题:
jQuery 中 focusin/focusout 与 focus/blur 有什么区别? https://stackoverflow.com/q/10584042/601179
答案是:
简短回答:focusin
气泡,focus
才不是。
focusout
气泡,blur
才不是。
我测试了一下,确实如此,但是我在尝试设置一个时遇到了奇怪的事情DEMO http://jsfiddle.net/gdoron/95u6a/:
$('#test').on('focusin focusout focus blur change', function(e) {
console.log(e.type + 'event bubles? : ' + e.bubbles);
});
focusin
and focusout
给我吗e.bubbles == false
这是 jQuery 的错误还是我在这里忽略了明显的内容?
Sounds like a bug in jQuery. Did you test this on a browser that supports focusin
and focusout
natively? (E.g., IE?) Because if not, you're testing the flag for jQuery's emulated support.
我划掉了上面的“听起来像一个 bug”,因为 jQuery 没有声称可以规范化bubbles
文档中的属性。因此,由于它不能保证这一点,因此它不必在模拟事件上支持它。 (请注意,如果我在 IE7 上运行你的演示,我会得到undefined
因为IE7不支持DOM3事件bubbles
财产。)仍然是issue,但也许不是bug. :-)
Update:
回应于jQuery 票证 http://bugs.jquery.com/ticket/11763:
该文档没有声称要规范化 event.bubbles 属性。您可以在 event.originalEvent 中查找它,但这将是平台提供的任何内容,未标准化。
所以我上面的猜测是正确的。这不是一个bug,因为他们没有声称要使其正常化。 :-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)