- From: Mathias FATENE <mathias.fatene@wanadoo.fr>
- Date: Wed, 24 Dec 2003 22:42:30 +0100
- To: <www-svg@w3.org>
Hi all,
I experiement a problem generated by alert() function in SVG, which cause
event loose. This is demonstrated in Message 38230 on
http://groups.yahoo.com/group/svg-developers/messages.
When we have this example :
---------------------------------------------
<svg>
<defs>
<rect id="titleBar" x="10" y="10" width="100" height="100" fill="red" />
</defs>
<g id="title" onmousedown="alert('title')">
<use xlink:href="#titleBar" x="-5" y="200" />
<animateMotion from="0,0" to="600,0" dur="1s" fill="freeze"
begin="title.click" />
</g>
<text id="status" x="100" y="100"> ? </text>
</svg>
---------------------------------------------
We can't see the click event effect, bacause of the javascript function
alert().
If we change the code like that :
---------------------------------------------
<svg>
<defs>
<rect id="titleBar" x="10" y="10" width="100" height="100" fill="red" />
</defs>
<g id="title"
onmousedown="document.getElementById('status').firstChild.setData('title')">
<use xlink:href="#titleBar" x="-5" y="200" />
<animateMotion from="0,0" to="600,0" dur="1s" fill="freeze"
begin="title.click" />
</g>
<text id="status" x="100" y="100"> ? </text>
</svg>
---------------------------------------------
All works perfectly.
Conclusion :
---------------
alert() can help for debugging, but is very bad when it
interacts with events. It simply eats them. Must be deprecated in
interactive SVG.
Cordialement
--------------------------------------
Mathias FATENE
Consultant ORACLE - BDD - Unix / Linux / Windows
mathias.fatene@wanadoo.fr
Received on Wednesday, 24 December 2003 16:49:10 UTC