Bug 50809 - Element not updated when referenced gradient has changed
Summary: Element not updated when referenced gradient has changed
Status: NEW
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: Scripting (show other bugs)
Version: 1.8
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-19 00:10 UTC by cujyaz
Modified: 2011-02-19 00:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cujyaz 2011-02-19 00:10:27 UTC
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)" );