TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Javascript event registration models, good explanation

24 pointsby erkin_unluover 13 years ago

2 comments

jarek-foksaover 13 years ago
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>
dmethvinover 13 years ago
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>