when I define a symbol with a rectangle, I can not place the rectangle
a the coordinates (0,0) if the rectangle has a border. If I do so the
border gets clipped and I can see only the half of the border.
Therefore I have to place the rectangle at an offset with is half of
the stroke-width of the rectangle.
My problem is, that I can not read the stroke-width property with the
style.getPropertyValue function, if I place the style definition an a
CSS file and assign the style via the class attribute. When I put the
style attribute directly in the SVG file, the getPropertyValue und
setProperty functions work as expected.
Any idea, how to put the style definitions in an external CSS file and
still be able to query them from JavaScript?
Regards
Sascha
Use getComputedStyle?
-Boris
This is what Firebug thinks.
The rect with the id "frame" is with the class "dialog_window"
defined, which renders the rect in some nice color (fill is set to
"#EEE"):
>>> document.getElementById("frame")
<rect id="frame" class="dialog_window" x="1" y="1" width="300"
height="200" rx="5" ry="5">
But when I call the function you suggest, I get an empty string:
>>> document.defaultView.getComputedStyle(document.getElementById("frame"), null).getPropertyValue ('fill');
""
Regards
Sascha
Are you perchance using Firefox 2?
-Boris
Why not turn clipping off then using overflow="visible"?
Best regards
Robert
2.0.0.14
Regards
Sascha
Maybe another approach but no solution to the problem to read style
attributes. ;-)
Regards
Sascha
If you want to solve that you need to install a firefox 3 beta.
getComputedStyle is not implemented for SVG in firefox 2.
Best regards
Robert.