Well, the behavior you see is as I would expect.
If you were to move your onclick="showCoord(evt)" to the superordinate <g id='canvas'> then target and currentTarget will be different. By placing the evt listener on the top, but invisible rectangle you've made it the only thing receiving the event. Also, get rid of the pointer-events thing. I cannot see a purpose for it. David From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of abel.zhangyu Sent: Tuesday, September 30, 2008 6:40 AM To: [email protected] Subject: [svg-developers] New to SVG: why the event target is not elment 'test3'? Hi All, I am a SVG newbie. i just created following quite simple svg document and expect when the mouse is clicking on rectangle 'test3', i can get the rectangle 'test3' from event's target attribute. but the actual result is either evt.target or evt.currentTarget always return rectangle 'test2' object. could you explain why it always returns 'test3' instead of 'test2'? thank you very much! <svg viewBox="0 0 1024 768" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="disable" xml:space="preserve"> <script> <![CDATA[ function showCoord(evt) { alert(evt.target.getAttribute("id") + " source:" + evt.currentTarget.getAttribute("id") + " phase:" + evt.eventPhase ); } ]]> </script> <g id="canvas"> <g id="xxxx"> <rect id="test4" x="145" y="95" width="105" height="105" style="fill:none"/> <rect id="test3" x="150" y="100" width="100" height="100" fill="blue"/> </g> <rect id="test2" x="0" y="0" width="100%" height="100%" onclick="showCoord(evt)" pointer-events="all" style="fill:none"/> </g> </svg> [Non-text portions of this message have been removed] ------------------------------------ ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

