I'm porting my Chrome extension into Safari, and I've encountered a little issue I would like to ask about.
Does anyone have an idea why the following code doesn't work in Safari, but does in Chrome?
shadow.addEventListener('click',function(e){
console.log(e);
if(e.target && e.path[0].id == "share"){
alert("clicked");
}
});
This gives me the following error in Safari: TypeError: undefined is not an object (evaluating 'e.path[0]')
and the console.log doesn't give me anything useful either.
I prefer this way instead of adding a seperate click event listener for each element, but unfortunately it doesn't seem to work in Safari, or should I change something to make it work in Safari?
I should mention that I have added the event listener to the shadow dom.