svgDocument
does not appear to be part of the W3C spec (from what I can tell). It is the equivalent of the document
object, which I would recommend using from now on. Existing code can be made compatible with Firefox by adding the following line of code:Trying to declareif (typeof(svgDocument) != "object") { svgDocument = document; }
var svgDocument
will return an error in AdobeSVG because svgDocument
appears to be a defined constant in AdobeSVG. Luckily JavaScript is flexible enough to still recognize this as a global variable.While Firefox supports the
getBBox()
method, using it onload
does not work as expected. The release notes for v1.5 indicate this is a problem with the current implementation of the load event. I was able to work around the problem by declaring the global variables that rely on getBBox()
but not setting their values. The values are set in a function that's called through a setTimeout()
.This setup requires that the
init()
function be removed from the SVG document's load event and called after the global variables have all been populated. As a fix it's not particularly elegant ... but it seems to work. I'm not entirely sure it's worth incorporating this one; I would this issue will be fixed in a later release.See:
- http://jibbering.com/2005/9/getBBox.svg
- http://developer.mozilla.org/en/docs/SVG_in_Firefox_1.5#Events
I believe that Firefox rewrites documents internally when rendering. Apparently the transform attribute is rewritten such that
translate(0,0)
is rewritten as translate(0)
. A way to work around this problem would be to write the function using regular expressions to parse the transform attribute. To get around this problem temporarily I rewrote the translate as (1,1)
.I think the
contextMenu
object may be proprietary to AdobeSVG. At the very least Firefox does not recognize it. Errors can be avoided by using the following to determine if contextMenu
exists prior to performing options on it:if (typeof(contextMenu) != "undefined") { ... }
Firefox 1.5 does not support the
selectSubString()
method.Despite many examples that have only two parameters in the
setProperty()
function it requires three. The third parameter can be null or an empty string ... but it has to be there. To fix just add a third parameter (""
) to each instance of setProperty()
.See:
- http://developer.mozilla.org/en/docs/SVG:Scripting#setProperty_has_three_parameters
- http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
- http://www.quirksmode.org/dom/w3c_css.html
Firefox diverges from the SVG spec with regards to the
font-size
style declaration. The spec indicates that a unit identifier (px, pt, etc.) is not necessary. However, Firefox chokes on a font-size
declaration that does not have a unit identifier. The fix is easy enough ... provide an identifier for font sizes.