Created
November 16, 2009 21:31
-
-
Save dperini/236339 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DOM Event test: order of execution</title> | |
<script type="text/javascript"> | |
// W3C DOM Event test | |
(function() { | |
if (document.addEventListener) { | |
document.addEventListener('click', handler1, false); | |
document.addEventListener('click', handler2, false); | |
document.addEventListener('click', handler3, false); | |
} else { | |
document.attachEvent('onclick', handler1); | |
document.attachEvent('onclick', handler2); | |
document.attachEvent('onclick', handler3); | |
} | |
function handler1(e) { | |
alert("* DOM order 1"); | |
} | |
function handler2(e) { | |
alert("* DOM order 2"); | |
} | |
function handler3(e) { | |
alert("* DOM order 3"); | |
} | |
})(); | |
</script> | |
</head> | |
<body> | |
<p>Click anywhere in the document; expected result order 1, 2, 3. All browsers except IE 6 / 7 / 8 !</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment