Exporting custom properties from fabricjs objects to SVG
<p>I have an image object where I have added a custom property.
When stringify the object, I can see that the property is there, but when I export the SVG by using toSVG, the custom property is not in the SVG source.</p>

<p>I would like the name property in my example to be exported as a custom property in the SVG image xml data (with the possibility to add multiple properties)</p>

<p>Is this possible?</p>

<p>Please se my fiddle: <a href="https://jsfiddle.net/Jonah/ujexg46s/" rel="nofollow noreferrer">https://jsfiddle.net/Jonah/ujexg46s/</a></p>

<pre><code>var svgImage = fabric.util.createClass(fabric.Image, {
  initialize: function(element, options) {
    this.callSuper("initialize", element, options);
    options &amp;&amp; this.set("name", options.name);
  },
  toObject: function() {
    return fabric.util.object.extend(this.callSuper('toObject'), {
      name: this.name
    });
  }
});

var canvas = new fabric.Canvas('container');

function loadImage() {
  var img = new Image();
  img.src = imageSrc;
  img.onload = function() {
    var image = new svgImage(img, {
      name: "test",
      left: 0,
      top: 0
    });
    canvas.add(image);
  }

}

document.getElementById('load-btn').onclick = function() {
  loadImage();
};

document.getElementById('export-btn').onclick = function() {
  canvas.deactivateAll().renderAll();
  console.log(JSON.stringify(canvas));
  window.open('data:image/svg+xml;utf8,' + encodeURIComponent(canvas.toSVG()));

};
</code></pre>