<html>
<head>
<title></title>
</head>
<body>
<div id="parent-1">
<div id="parent-2">
<div id="parent-3">
<button id="click-target">Click me</button>
</div>
</div>
</div>
<script>
const list = document.querySelector('#click-target');
list.addEventListener('click', () => console.log(list.id), );
const list1 = document.querySelector('#parent-3');
list.addEventListener('click', () => console.log(list1.id), true);
const list2 = document.querySelector('#parent-2');
list.addEventListener('click', () => console.log(list2.id), true);
const block = document.querySelector('#parent-1');
block.addEventListener('click', () => console.log(block.id), true);
</script>
</body>
</html>```
Не могу понять почему работает некорректно [upl-image-preview url=https://ru.coderslang.com/assets/files/2022-07-19/1658228556-588-screenshot-1.png]
[upl-image-preview url=https://ru.coderslang.com/assets/files/2022-07-19/1658228556-35790-screenshot-2.png]