Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-562

Script events don't trigger on <defs> elements

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Resolution: Unresolved
    • 1.5
    • None
    • Scripting
    • None
    • Operating System: Windows XP
      Platform: PC

    Description

      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>

      Attachments

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            robw@ascert.com Rob Walker
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: