<div id="parent-1">
<div id="child-1"></div>
</div>
<div id="parent-2">
<div id="child-2"></div>
</div>
<div id="parent-3">
<div id="child-3"></div>
</div>
<div id="test">
<div id="parent-1">
<div id="child-1">child-1</div>
</div>
<div id="parent-2">
<div id="child-2">child-2</div>
</div>
<div id="parent-3">
<div id="child-3">child-3</div>
</div>
</div>
<script type="text/javascript">
'use strict';
var test= document.getElementById('test');
test.onclick= function(e) {
var t= e.target;
if (t.id.indexOf('child') === -1) return;
t.parentNode.classList.add('myClass');
e.stopPropagation();
}
</script>