JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box1">
<div id="box2"></div>
</div>
CSS
#box1{
width: 200px;
height: 200px;
background-color: blanchedalmond;
}
#box2{
width: 100px;
height: 100px;
background-color: #add8e6;
}
JavaScript
var box1 = document.getElementById('box1'),
box2 = document.getElementById('box2');
box1.addEventListener('click',function(ev){
alert('----box1冒泡阶段----');
},false);
box2.addEventListener('click',function(ev){
alert('----box2冒泡阶段----');
ev.stopPropagation();
},false);