Tuesday, February 28, 2006

SVG: Compatibility between Adobe and Firefox

I did some compatibility testing for the SMS project. Follows are notes related to that testing.


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:
if (typeof(svgDocument) != "object") { svgDocument = document; }
Trying to declare 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:

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:

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.

Thursday, February 23, 2006

Mass Mailing: 2061 Connections - January/February 2006

The January/February 2006 issue of 2061 Connections went out on 23 Feb 2006 at 4:29:54 PM to 3818 recipients.

Wednesday, February 15, 2006

Mass Mailing: Workshops

The workshop notification went out on 13 Feb 2006 at 3:51 PM to 2457 recipients.