Bug 35629 - Script events don't trigger on <defs> elements
Summary: Script events don't trigger on <defs> elements
Status: ASSIGNED
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: Scripting (show other bugs)
Version: 1.5
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-06 14:03 UTC by Rob Walker
Modified: 2007-01-21 19:26 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Walker 2005-07-06 14:03:21 UTC
Basically, when a script event is defined on an element in <defs> it doesn't
seem to trigger. If it's added to a <use> element referencing the def it works.
If included on both, only the <use> script event fires.

Example is included below. Tested this on the Adobe SVG plugin 6.0 in both
Explorer and Firefox and it triggers both events, the <use> event and the <def>
event.

==============================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://web.resource.org/cc/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   id="svg2" height="100" width="100">
   
   <script language="javascript" id="script1292">
     <![CDATA[
    
    function showInfo(evt) 
    {
        var msg = "";
        if (evt.target != null)
        {
            msg += "Target: " + evt.target;
        }
        if (evt.currentTarget != null)
        {
            msg += "\n Clicked currentTarget: " + evt.currentTarget;
        }
        alert(msg);
    }
    
    function userPressedKey(evt) 
    {
        var msg = "";
        if (evt.currentTarget != null)
        {
            msg += "User pressed: " + evt.currentTarget.getAttribute("id");
        }
        alert(msg);
    }
    
    ]]>
    </script>
    
    <defs>
      <rect id="FDK"  y="5.0" x="5.0" height="30" width="30"
         style="fill:#eeff00" opacity="0.5"
         onclick="showInfo(evt)" />
    </defs>
    
    <g id="layer1">
      <use id="FDK-A" xlink:href="#FDK"
         onclick="userPressedKey(evt)" />
    </g>
</svg>
Comment 1 Cameron McCormack 2007-01-21 19:26:00 UTC
This is because Batik currently does not implement the SVGElementInstance view
of 'use'd objects.