Re: Problems with CSS Styles: font-weight change but stoke and fill color won't!
Boris Zbarsky <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Message-ID | <[email protected]> |
Siegfried Heintze wrote: > document.styleSheets[0].cssRules[27].style.fontWeight="light"; ... > document.styleSheets[0].cssRules[26].style.fill > ="black";document.styleSheets[0].cssRules[26].style.stroke ="black"; The relevant specification (DOM2 Style) only defines direct property access for the properties that existed at the time it was written (so more or less CSS 2.0). Note that the interface is called CSS2Properties. So no SVG things on that interface. See also https://bugzilla.mozilla.org/show_bug.cgi?id=374216 You can always set any CSS property you want by using .style.setProperty(name, value, "") (or "important" for that last bit if desired). > I suppose I could define > some symbolic integer constants in javascript (how do I do that?) const name = value; Your real issue here is that there is no good way to identify a given style rule. Not much to work with there. > Also: can I use the same style for rects as I do paths as I do text? So far, > the only way I can make things work is to define seperate entries in my > <style> </style> section for text, paths, rects etc... Uh... yes, you should be able to use the same style for all three. What are you trying to do, exactly? How does it fail? Have you read the CSS specification (at least the part on selectors)? -Boris