#test {
width: 100px;
height: 100px;
background-color: #ddd;
}
test.onclick = function(e) {
console.log(e);
}
если раскрыть объект в консоли, то увидим, что currentTarget: null ?
при этом если выписать console.log(e.currentTarget) - то всё-таки там не null, а этот див.. как так то? почему объект MouseEvent нас вводит в заблуждение?
Вот простой пример для понимания. var a = {name:'Vasya'} var b = a; console.log(b) delete a.name; console.log(b)
– Kamil Magomedov Sep 06 '17 at 07:39