SVGElements don't have outerHTML property.
You can define like this in pure Javascript
Object.defineProperty(SVGElement.prototype, 'outerHTML', {
get: function () {
var $node, $temp;
$temp = document.createElement('div');
$node = this.cloneNode(true);
$temp.appendChild($node);
return $temp.innerHTML;
},
enumerable: false,
configurable: true
});
Or a one line jQuery solution would be
$('<div>').append($(svgElement).clone()).html();
Reference:
https://gist.github.com/jarek-foksa/2648095
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…