Bug 12229 - setAttributeNS(null,"fill","red") not working for polygons
Summary: setAttributeNS(null,"fill","red") not working for polygons
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 420+
Hardware: Mac (PowerPC) OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-12 12:35 PST by Russell Gum
Modified: 2014-04-24 16:44 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Russell Gum 2007-01-12 12:35:19 PST
function changeColor(evt, id) {
     	 var SVGDoc = evt.getTarget().getOwnerDocument();
			var state = SVGDoc.getElementById(id);
			var style = state.getStyle();
			evt.target.setAttributeNS(null,"fill","red");
			
   	 }

works for rectangles and circles but not for polygons

<rect id="myBlueRect" width="100" height="50" x="1500" y="1000" fill="blue" onclick="changeColor(evt, 'myBlueRect')"/>      works

<polygon id="F02" class="S40F02" style="fill: white"  stroke="blue" stroke-width="2" onmouseover="changeColor(evt, 'S40F02')" 
 points="
687.0,958.0
786.0,958.0
813.0,1030.0
714.0,1030.0
" />  does not work
Comment 1 Rob Buis 2007-01-12 13:37:37 PST
Hi,

Actually this is the expected behaviour, I checked with Opera and FF. What happens is that
for the rect the presentation attribute is overwritten on click, which is fine. For the polygon however
two different style entities are used. On the polygon the inline style is set and the presentation attribute fill is again set (onmouseover). But here the inline style always wins, so the fill is unchanged.
Cheers,

Rob.
Comment 2 Darin Adler 2014-04-24 16:44:51 PDT
Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.