Hi Praveen,
> I would like to know if
> 1. this is a part of the SVG standard, or is it a small bug in Batik,
> because Adobe viewer works the same in both the cases.
I think this is a bug. The basic problem is our implementation of
the 'default action' (the traversal of the link). We implement the
traversal of the link as an event listener, so you need to call
'preventDefault' before our click event handler on the 'a' element
is fired. However reading the DOM 2 Events spec:
preventDefault
If an event is cancelable, the preventDefault method is used to signify
that the
event is to be canceled, meaning any default action normally taken by the
implementation
as a result of the event will not occur. If, during any stage of event
flow, the
preventDefault method is called the event is canceled. Any default action
associated with the event will not occur. Calling this method for a
non-cancelable
event has no effect. Once preventDefault has been called it will remain in
effect throughout the remainder of the event's propagation. This method
may be used
during any stage of event flow.
> 2. On the off chance that it is a bug, will there be a fix anytime soon?
I can think of one or two "low impact" ways to fix this, but I don't
think this will happen before the next release.
"Praveen Nayak" <[EMAIL PROTECTED]> wrote on 01/31/2007 07:37:51
AM:
> In the code below, the circle and the rect are associated with the the
> hyperlink and the onclick event; and according to the hierarchy of event
> handling, the javascript method is called first, the preventDefault()
> prevents the loading of a.svg. Note the order of <a> and <g> tags.
>
> <svg xmlns:xlink="http://www.w3.org/1999/xlink">
> <script type="text/ecmascript">
> function TestScript(evt){
> alert ("Here");
> var ob = evt.preventDefault();
> }
> </script>
> <a xlink:href="a.svg">
> <g onclick="TestScript(evt)">
> <circle cx="100" cy="100" r="200" />
> <rect x="300" y="300" height="100" width="100" />
> </g>
> </a>
> </svg>
>
> The above svg works fine.
>
> The following does not meet my expectations as the clicking of the link
> on the circle loads the a.svg file and it appears that the circle click
> is not associated with the TestScript method.
>
> <svg xmlns:xlink="http://www.w3.org/1999/xlink">
> <script type="text/ecmascript">
> function TestScript(evt){
> alert ("Here");
> var ob = evt.preventDefault();
> }
> </script>
> <g onclick="TestScript(evt)">
> <a xlink:href="a.svg">
> <circle cx="100" cy="100" r="200" />
> <rect x="300" y="300" height="100" width="100" />
> </a>
> </g>
> </svg>
>
> Thanks,
> Praveen
>
--------------------------------------------------------------------------------
> Telelogic Lifecycle Solutions:
> Helping You Define, Design & Deliver Advanced Systems & Software
> Learn More at www.telelogic.com
>
>
> Praveen Nayak
> Software Engineer
> Telelogic India Pvt Ltd
> #58, 1- 4 HM Towers,
> Brigade Road,
> 560 025 Bangalore
> India
>
> Phone: +91 (80) 419 95800 x194
> Fax:
> Mobile phone:
>
> [EMAIL PROTECTED]
> http://www.telelogic.com
>
>
> Telelogic - Requirements-Driven Innovation!
> -------------------------------------------------------------
>
>
>
> The information contained in this e-mail, including any attachment
> or enclosure, is intended only for the person or entity to which it
> is addressed and may contain confidential material. Any unauthorized
> use, review, retransmissions, dissemination, copying or other use of
> this information by persons or entities other than the intended
> recipient is prohibited.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]