master
Dmitry Baranovskiy 2013-09-11 14:38:52 +10:00
parent be42ac9b88
commit be91a1b24f
3 changed files with 46 additions and 25 deletions

6
dist/savage-min.js vendored

File diff suppressed because one or more lines are too long

35
dist/savage.js vendored
View File

@ -3090,7 +3090,7 @@ function arrayFirstValue(arr) {
= (Element) the element = (Element) the element
\*/ \*/
elproto.animate = function (attrs, ms, easing, callback) { elproto.animate = function (attrs, ms, easing, callback) {
if (typeof easing == "function") { if (typeof easing == "function" && !easing.length) {
callback = easing; callback = easing;
easing = mina.linear; easing = mina.linear;
} }
@ -3193,15 +3193,35 @@ function arrayFirstValue(arr) {
} }
return this; return this;
}; };
elproto.toString = function () { /*\
var res = "<" + this.type, * Element.toString
[ method ]
**
* Returns SVG code of the element. Equivalent to `outerHTML` in HTML context.
= (string) SVG code of the element.
\*/
elproto.toString = toString(1);
/*\
* Element.innerSVG
[ method ]
**
* Returns SVG code of the element. Equivalent to `innerHTML` in HTML context.
= (string) SVG code of the element.
\*/
elproto.innerSVG = toString();
function toString(type) {
return function () {
var res = type ? "<" + this.type : "",
attr = this.node.attributes, attr = this.node.attributes,
chld = this.node.childNodes; chld = this.node.childNodes;
if (type) {
for (var i = 0, ii = attr.length; i < ii; i++) { for (var i = 0, ii = attr.length; i < ii; i++) {
res += " " + attr[i].name + '="' + attr[i].value.replace(/"/g, '\\"') + '"'; res += " " + attr[i].name + '="' +
attr[i].value.replace(/"/g, '\\"') + '"';
}
} }
if (chld.length) { if (chld.length) {
res += ">"; type && (res += ">");
for (i = 0, ii = chld.length; i < ii; i++) { for (i = 0, ii = chld.length; i < ii; i++) {
if (chld[i].nodeType == 3) { if (chld[i].nodeType == 3) {
res += chld[i].nodeValue; res += chld[i].nodeValue;
@ -3209,12 +3229,13 @@ function arrayFirstValue(arr) {
res += wrap(chld[i]).toString(); res += wrap(chld[i]).toString();
} }
} }
res += "</" + this.type + ">"; type && (res += "</" + this.type + ">");
} else { } else {
res += "/>"; type && (res += "/>");
} }
return res; return res;
}; };
}
}(Element.prototype)); }(Element.prototype));
/*\ /*\
* Savage.parse * Savage.parse

View File

@ -2024,7 +2024,7 @@ function arrayFirstValue(arr) {
= (Element) the element = (Element) the element
\*/ \*/
elproto.animate = function (attrs, ms, easing, callback) { elproto.animate = function (attrs, ms, easing, callback) {
if (typeof easing == "function") { if (typeof easing == "function" && !easing.length) {
callback = easing; callback = easing;
easing = mina.linear; easing = mina.linear;
} }