1

I have an SVG element inside HTML document that I'd like to export as text.

I know HTML doesn't have namespace hence it doesn't honor one, that is probably why I lose namespace prefixes on my SVG element.

Are there ways to preserve it other than writing my own serializer?

Example code:

var s = new XMLSerializer();
var svg = document.getElementById('mySvg');
console.log(s.serializeToString(svg)); //All namespace prefixes are gone!

Edit: apparently this is Chrome's (tested on v17) bug.

syaz
  • 2,659
  • 6
  • 36
  • 44

1 Answers1

0

This is chrome's bug: http://code.google.com/p/chromium/issues/detail?id=88295

For now I have to manually do a search/replace namespaces after calls to serializeToString.

syaz
  • 2,659
  • 6
  • 36
  • 44