Editing
JavaScript/Notes/EventNotificationSystem
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====DOM Events Test==== <source lang="javascript">(function(){ var passed = false; var el = document.getElementById("registry-dom-event-button"); el.addEventListener( "click", setUpCheck, false ); el.addEventListener("click", throwError, false ); // setTitle must fire. el.addEventListener( "click", setTitle, false ); function setUpCheck(){ setTimeout(checkTitle, 500); } function throwError(){ throw Error('bad'); } function setTitle(){ passed = true; } function checkTitle(ev) { if(!passed) { alert("DOM Events broken: setTitle did not fire. "); } else { alert("passed"); } } })();</source> [http://jsbin.com/IVEmOpAZ/1/edit jsbin] <h4>Result and Analysis</h4> <p>There should be 1 error and an alert <kbd>passed</kbd>. This indicates that after the error happened, the <code>setTitle</code> callback successfully fired. </p> <p> This example assumes: </p> <ul> <li> Callbacks fire in the order in which they were registered. </li> <li> The <kbd>bad</kbd> error in the first callback does not stop subsequent callbacks from firing. </li> <li> The button supports the <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Registration-interfaces"><code>EventTarget</code> interface</a> (not in IE7). </li> <li> The <code>button</code> supports onfocus (not in safari <a href="http://bugs.webkit.org/show_bug.cgi?id=16331">bug 16331</a>). </li> </ul>
Summary:
Please note that all contributions to Noisebridge are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Noisebridge:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Request account
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Dig in!
Noisebridge
- Status: MOVED
- Donate
- ABOUT
- Accessibility
- Vision
- Blog
Manual
MANUAL
Visitors
Participation
Community Standards
Channels
Operations
Events
EVENTS
Guilds
GUILDS
- Meta
- Electronics
- Fabrication
- Games
- Music
- Library
- Neuro
- Philosophy
- Funding
- Art
- Crypto
- Documentation/Wiki
Wiki
Recent Changes
Random Page
Help
Categories
(Edit)
Tools
What links here
Related changes
Special pages
Page information