I came across an other extremely simple way to do it in Vanilla JS so I post it here for reference:
function whoami () {
var caller = event.target;
alert("I'm " + caller.textContent);
}
I'm not sure about the browser support for it but it works at least on Safari, Firefox and Blink based browsers.