Bug 12229
Summary: | setAttributeNS(null,"fill","red") not working for polygons | ||
---|---|---|---|
Product: | WebKit | Reporter: | Russell Gum <russgum> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | ||
Priority: | P2 | ||
Version: | 420+ | ||
Hardware: | Mac (PowerPC) | ||
OS: | OS X 10.4 |
Russell Gum
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
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Rob Buis
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.
Darin Adler
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.