In the event handler for an element with a default capture (false), this will refer to the element that detected the event. You can use any of them.
For instance:
element.addEventListener('keydown', function (event) {
When capturing an event (true), say, at the window level event.target , it will refer to the element that triggered the event, and this will refer to the capture element. For instance:
window.addEventListener("error", function (event) { event.target.src = 'some_path';
I hope this illustrates the difference between each.
source share