You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by th...@kodak.com on 2007/02/02 13:06:53 UTC

RE: Script and anchor tag

Hi Praveen,

"Praveen Nayak" <Pr...@telelogic.com> wrote on 02/02/2007 06:47:36 
AM:

> Can you tell me in what areas you were looking for the the low impact
> fixes.

   The basic idea would be to add a 'defaultAction' field to
the base event structure.  This would probably be a simple
Runnable.  When a 'defaultAction's listener is called rather
than performing it's action immediately it would set the
field to it's runnable that will do the action.

   Then in the dom.events.EventSupport.dispatchEvent
it would at the very end check the status of 'preventDefault'
and the defaultAction field and call the runnable, if any.

   The one 'gotcha' in this approach is the handling of 
multiple 'defaultAction' elements in the chain.  Do you
run all of them (make it a List), run just the first, just
the last, all of them if they are "different" (so just one
'a').  This is really a spec question, but I doubt the
spec answers the question ;)

> Maybe I can try it on my own for my current implementation.

   I've cross posted to 'batik-dev' which is a more
appropriate forum for this sort of discussion. If you reply
please strip 'batik-users'.

> -----Original Message-----
> From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Sent: Friday, February 02, 2007 5:10 PM
> To: batik-users@xmlgraphics.apache.org
> Cc: batik-users@xmlgraphics.apache.org
> Subject: Re: Script and anchor tag
> 
> 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" <Pr...@telelogic.com> 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: 
> > 
> > Praveen.Nayak@telelogic.com
> > 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: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
> > batik-users-help@xmlgraphics.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org 

> 
--------------------------------------------------------------------------------
> 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: 
> 
> Praveen.Nayak@telelogic.com
> 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: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


RE: Script and anchor tag

Posted by th...@kodak.com.
Hi Praveen,

   I fixed this in SVN.

thomas.deweese@kodak.com wrote on 02/02/2007 07:06:53 AM:

> Hi Praveen,
> 
> "Praveen Nayak" <Pr...@telelogic.com> wrote on 02/02/2007 
06:47:36 
> AM:
> 
> > Can you tell me in what areas you were looking for the the low impact
> > fixes.
> 
>    The basic idea would be to add a 'defaultAction' field to
> the base event structure.  This would probably be a simple
> Runnable.  When a 'defaultAction's listener is called rather
> than performing it's action immediately it would set the
> field to it's runnable that will do the action.
> 
>    Then in the dom.events.EventSupport.dispatchEvent
> it would at the very end check the status of 'preventDefault'
> and the defaultAction field and call the runnable, if any.
> 
>    The one 'gotcha' in this approach is the handling of 
> multiple 'defaultAction' elements in the chain.  Do you
> run all of them (make it a List), run just the first, just
> the last, all of them if they are "different" (so just one
> 'a').  This is really a spec question, but I doubt the
> spec answers the question ;)
> 
> > Maybe I can try it on my own for my current implementation.
> 
>    I've cross posted to 'batik-dev' which is a more
> appropriate forum for this sort of discussion. If you reply
> please strip 'batik-users'.
> 
> > -----Original Message-----
> > From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> > Sent: Friday, February 02, 2007 5:10 PM
> > To: batik-users@xmlgraphics.apache.org
> > Cc: batik-users@xmlgraphics.apache.org
> > Subject: Re: Script and anchor tag
> > 
> > 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" <Pr...@telelogic.com> 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: 
> > > 
> > > Praveen.Nayak@telelogic.com
> > > 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: 
batik-users-unsubscribe@xmlgraphics.apache.org
> > > For additional commands, e-mail: 
> > > batik-users-help@xmlgraphics.apache.org
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org 
> 
> > 
> 
--------------------------------------------------------------------------------
> > 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: 
> > 
> > Praveen.Nayak@telelogic.com
> > 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: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


RE: Script and anchor tag

Posted by th...@kodak.com.
Hi Praveen,

   I fixed this in SVN.

thomas.deweese@kodak.com wrote on 02/02/2007 07:06:53 AM:

> Hi Praveen,
> 
> "Praveen Nayak" <Pr...@telelogic.com> wrote on 02/02/2007 
06:47:36 
> AM:
> 
> > Can you tell me in what areas you were looking for the the low impact
> > fixes.
> 
>    The basic idea would be to add a 'defaultAction' field to
> the base event structure.  This would probably be a simple
> Runnable.  When a 'defaultAction's listener is called rather
> than performing it's action immediately it would set the
> field to it's runnable that will do the action.
> 
>    Then in the dom.events.EventSupport.dispatchEvent
> it would at the very end check the status of 'preventDefault'
> and the defaultAction field and call the runnable, if any.
> 
>    The one 'gotcha' in this approach is the handling of 
> multiple 'defaultAction' elements in the chain.  Do you
> run all of them (make it a List), run just the first, just
> the last, all of them if they are "different" (so just one
> 'a').  This is really a spec question, but I doubt the
> spec answers the question ;)
> 
> > Maybe I can try it on my own for my current implementation.
> 
>    I've cross posted to 'batik-dev' which is a more
> appropriate forum for this sort of discussion. If you reply
> please strip 'batik-users'.
> 
> > -----Original Message-----
> > From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> > Sent: Friday, February 02, 2007 5:10 PM
> > To: batik-users@xmlgraphics.apache.org
> > Cc: batik-users@xmlgraphics.apache.org
> > Subject: Re: Script and anchor tag
> > 
> > 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" <Pr...@telelogic.com> 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: 
> > > 
> > > Praveen.Nayak@telelogic.com
> > > 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: 
batik-users-unsubscribe@xmlgraphics.apache.org
> > > For additional commands, e-mail: 
> > > batik-users-help@xmlgraphics.apache.org
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org 
> 
> > 
> 
--------------------------------------------------------------------------------
> > 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: 
> > 
> > Praveen.Nayak@telelogic.com
> > 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: batik-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: 
batik-users-help@xmlgraphics.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org