MCPcopy
hub / github.com/adobe-webplatform/Snap.svg / toString

Function toString

src/element.js:742–768  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

740 \*/
741 elproto.innerSVG = toString();
742 function toString(type) {
743 return function () {
744 var res = type ? "<" + this.type : "",
745 attr = this.node.attributes,
746 chld = this.node.childNodes;
747 if (type) {
748 for (var i = 0, ii = attr.length; i < ii; i++) {
749 res += " " + attr[i].name + '="' +
750 attr[i].value.replace(/"/g, '\\"') + '"';
751 }
752 }
753 if (chld.length) {
754 type && (res += ">");
755 for (i = 0, ii = chld.length; i < ii; i++) {
756 if (chld[i].nodeType == 3) {
757 res += chld[i].nodeValue;
758 } else if (chld[i].nodeType == 1) {
759 res += wrap(chld[i]).toString();
760 }
761 }
762 type && (res += "</" + this.type + ">");
763 } else {
764 type && (res += "/>");
765 }
766 return res;
767 };
768 }
769 elproto.toDataURL = function () {
770 if (window && window.btoa) {
771 var bb = this.getBBox(),

Callers 1

element.jsFile · 0.70

Calls 1

wrapFunction · 0.70

Tested by

no test coverage detected