Sorry, this seems like a great crowd fan ... That's why firefox did not change its code to fully match the Event object, just like Chrome. I did my homework, tried some of the solutions given here in StackOverflow, but nothing works. I have this code:
function xpto(e) { if( !e ) e = window.event; var x = e.target||e.srcElement; alert(x); ........ }
The call is made as follows:
<svg id="graph-svg" onclick="xpto(event)" style="outline: none;" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
Yes ... This is the svg element I'm trying to click. I did not put the complete code because it was not relevant to the question. Bottom line
alert(x)
always warns with undefined in Firefox and runs on Chrome as a charm. I can capture the event in Firefox, but the "x" always cames undefined.
In firefox, either Event or SVG are supported in the DOM description. The event is even defined using the "target" and "srcElement" properties for backward compatibility.
I am using Firefox 20 on Ubuntu ... Can anyone help?
source share