所有浏览器都支持事件冒泡吗?
jQuery 使用事件冒泡策略来处理事件。
而且号称是跨浏览器的,
但是“事件冒泡”是所有浏览器都支持的吗?
还有一种策略:事件捕获,与事件冒泡相反,是不是已经绝迹了?
或者我的问题可以重新表述为:
Javascript可以自行决定选择“事件捕获”策略还是“事件冒泡”策略吗?
jQuery uses event bubbling strategy to handle events.
And it claims to be cross browser,
but is "event bubbling" supported by all browsers?
There is another strategy: event capturing, which is reverse to event bubbling,is it extinct?
Or my question could be re-stated as:
Can Javascript decides on whether choosing "event capturing" strategy or "event bubbling" strategy by itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
所有浏览器?不。例如,Lynx 根本不支持 JavaScript。
然而,事件冒泡是一个标准的 DOM 功能。 jQuery 文档没有骗你。
All browsers? No. Lynx, for instance, doesn't support JavaScript at all.
However, event bubbling is a standard DOM feature. The jQuery documentation is not lying to you.
从 jQuery 兼容性页面,它支持以下浏览器:
全部支持事件冒泡。
根据 W3Schools 浏览器使用页面,这些浏览器占99.2%兜售毫无意义的迂腐或者什么也没有。如果您是任何其他浏览器的用户,您可能已经远离主流,有自己的方法来处理浏览器问题。
From the jQuery compatibility page, it supports the following browsers:
All of which support event bubbling.
According to the W3Schools browser usage page those browsers account for 99.2% of all browser usage in July 2009, I'd say this is cross-browser support covered. Ignore those peddling pointless pedantry about browser support being all or nothing. If you're a user of any other browser you are probably far enough from the mainstream to have your own methods of dealing with browser issues.
简而言之,是的。 Netscape Navigator 4 不支持它,但我认为现在对支持 Netscape 4 没有太多担心。
In short, yes. Netscape Navigator 4 doesn't support it, but I don't think there's a lot of worry about supporting Netscape 4 these days.
要么他们在撒谎,要么“跨浏览器”的定义需要稍微改变一下。它要么是跨浏览器的,要么不是,没有中间地带。
Either they are lying, or the definition for "Cross-Browser" needs to be slightly altered. It's either cross-browser or it isn't there's no in-between.