Skip to content

Instantly share code, notes, and snippets.

@natebunnyfield
Created July 30, 2010 17:38
Show Gist options
  • Save natebunnyfield/500964 to your computer and use it in GitHub Desktop.
Save natebunnyfield/500964 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!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, true);
// 2
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, false);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, false);
// 3
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, false);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(){ event.stopPropagation(); log('the_item!') }, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment