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

63
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,28 +3193,49 @@ function arrayFirstValue(arr) {
} }
return this; return this;
}; };
elproto.toString = function () { /*\
var res = "<" + this.type, * Element.toString
attr = this.node.attributes, [ method ]
chld = this.node.childNodes; **
for (var i = 0, ii = attr.length; i < ii; i++) { * Returns SVG code of the element. Equivalent to `outerHTML` in HTML context.
res += " " + attr[i].name + '="' + attr[i].value.replace(/"/g, '\\"') + '"'; = (string) SVG code of the element.
} \*/
if (chld.length) { elproto.toString = toString(1);
res += ">"; /*\
for (i = 0, ii = chld.length; i < ii; i++) { * Element.innerSVG
if (chld[i].nodeType == 3) { [ method ]
res += chld[i].nodeValue; **
} else if (chld[i].nodeType == 1) { * Returns SVG code of the element. Equivalent to `innerHTML` in HTML context.
res += wrap(chld[i]).toString(); = (string) SVG code of the element.
\*/
elproto.innerSVG = toString();
function toString(type) {
return function () {
var res = type ? "<" + this.type : "",
attr = this.node.attributes,
chld = this.node.childNodes;
if (type) {
for (var i = 0, ii = attr.length; i < ii; i++) {
res += " " + attr[i].name + '="' +
attr[i].value.replace(/"/g, '\\"') + '"';
} }
} }
res += "</" + this.type + ">"; if (chld.length) {
} else { type && (res += ">");
res += "/>"; for (i = 0, ii = chld.length; i < ii; i++) {
} if (chld[i].nodeType == 3) {
return res; res += chld[i].nodeValue;
}; } else if (chld[i].nodeType == 1) {
res += wrap(chld[i]).toString();
}
}
type && (res += "</" + this.type + ">");
} else {
type && (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;
} }