TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Javascript event registration models, good explanation

24 点作者 erkin_unlu超过 13 年前

2 条评论

jarek-foksa超过 13 年前
It's worth noting that DOM4 spec makes third argument in addEventListener() method optional.<p>It will default to false if you skip it (which is almost always preferable):<p><pre><code> element.addEventListener('mousedown', callback);</code></pre>
dmethvin超过 13 年前
There's also an object-based argument to addEventListener: <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener" rel="nofollow">http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-E...</a><p>More discussion here: <a href="http://ajaxian.com/archives/an-alternative-way-to-addeventlistener" rel="nofollow">http://ajaxian.com/archives/an-alternative-way-to-addeventli...</a>