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
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.
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.