Skip to content

Instantly share code, notes, and snippets.

@cameronism
Created March 4, 2011 19:45
Show Gist options
  • Save cameronism/855582 to your computer and use it in GitHub Desktop.
Save cameronism/855582 to your computer and use it in GitHub Desktop.
// 1
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, !true);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, true);
// 2
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, !true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, !true);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, true);
// 3
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, !true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, !true);
document.getElementById('the_item').addEventListener(
'click', function(e){ log('the_item!'); e.stopPropagation() }, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment