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

Element not updated when referenced gradient has changed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.8
    • None
    • Scripting
    • None
    • Operating System: Linux
      Platform: PC

    Description

      Dynamic modification of gradients doesn't work in Batik:

      <?xml version="1.0" encoding="iso-8859-1"?>
      <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      viewBox="-1 -1 4 4" onload="Init()">
      <script type="text/ecmascript"><![CDATA["use strict";
      var SVG= "http://www.w3.org/2000/svg";
      function Init()

      { var elt= document.createElementNS( SVG, "stop" ); elt.setAttribute( "offset", "0" ); document.getElementById( "grad" ).appendChild( elt ); }

      ]]></script>
      <linearGradient id="grad"/>
      <rect id="rect" width="2" height="2" fill="url(#grad)"/>
      </svg>

      This should display a black square. In Batik, this works only after removing and re-setting the fill attribute:

      document.getElementById( "rect" ).removeAttribute( "fill" );
      document.getElementById( "rect" ).setAttribute( "fill", "url(#grad)" );

      Attachments

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            cujyaz@googlemail.com cujyaz
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: