Closed Bug 536779 Opened 15 years ago Closed 15 years ago

Altering the ".style.fill" attribute of an SVG shape element does not change its fill.

Categories

(Core :: SVG, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 374216

People

(Reporter: chriswjohnson, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2b5) Gecko/20091204 Firefox/3.6b5

Here's a simple, example SVG document that demonstrates the bug [I was hoping the bug reporter would provide a means to attach files like this to bug reports, but I can't find such a feature]:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox='-100 -100 200 200' version='1.1' xmlns='http://www.w3.org/2000/svg' contentScriptType='text/ecmascript'>

	<title>Runtime SVG Fill Bug</title>
	
	<desc>The circle's fill color is set to purple by the script below that alters its "style.fill" property, but 
	Firefox does not render the circle filled with purple. Safari and Chrome *do* render it filled with purple. Due to 
	their common WebKit engine, their shared behavior isn't surprising, but it does appear to be correct. Firefox's 
	behavior appears to be incorrect. Note that altering other style properties, for instance:
	
		document.getElementById("iris").style.display = "none";
	
	...does work in Firefox.
	</desc>
	

	<circle id='iris' cx='0' cy='0' r='75' stroke='black'/>

	
	<script type='text/ecmascript'><![CDATA[
	
		document.getElementById("iris").style.fill = "#CA7ADE";
	
	]]></script>

</svg>

Reproducible: Always

Steps to Reproduce:
1. Take the example SVG from the "Details" portion of this bug report, and save it as file named "test.svg".
2. Open the "test.svg" file in Firefox.
3. Observe that the circle is not filled with purple, as set by the embedded, single-line script which sets the circle element's ".style.fill" property.
Actual Results:  
A circle filled with black was drawn.

Expected Results:  
A circle filled with purple should have been drawn.

Filled the circle with purple, as the WebKit-based browsers do.
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.