All examples By author By category About

enjalot

webkit dom serialization issue

This code takes an existing svg element and rasterizes it with canvas.

The problem is that in webkit the namespaces for href's are not captured in the serialization, they should be "xlink:href=..." but instead are just "href=" The same problem happens with the xmnls:xlink= losing its "xmnls".

To get around this I run a regular expression on the svg if it's in webkit. This isn't necessary in firefox.