A bit more precise handling of group array-like possibilities. #94

master
Dmitry Baranovskiy 2013-11-26 18:46:13 +11:00
parent 9fa23f0f95
commit d6fc9070c5
4 changed files with 164 additions and 98 deletions

File diff suppressed because one or more lines are too long

55
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// build: 2013-11-25 // build: 2013-11-26
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -2164,8 +2164,8 @@ function add2group(list) {
} }
} }
var children = node.childNodes; var children = node.childNodes;
for (i = 0; i < children.length; i++) if (children[i].snap) { for (i = 0; i < children.length; i++) {
this[j++] = hub[children[i].snap]; this[j++] = wrap(children[i]);
} }
} }
function Element(el) { function Element(el) {
@ -2384,16 +2384,18 @@ function arrayFirstValue(arr) {
* See @Element.append * See @Element.append
\*/ \*/
elproto.append = elproto.add = function (el) { elproto.append = elproto.add = function (el) {
if (el) {
if (el.type == "set") { if (el.type == "set") {
var it = this; var it = this;
el.forEach(function (el) { el.forEach(function (el) {
it.append(el); it.add(el);
}); });
return this; return this;
} }
el = wrap(el); el = wrap(el);
this.node.appendChild(el.node); this.node.appendChild(el.node);
el.paper = this.paper; el.paper = this.paper;
}
return this; return this;
}; };
/*\ /*\
@ -2406,8 +2408,10 @@ function arrayFirstValue(arr) {
= (Element) the child element = (Element) the child element
\*/ \*/
elproto.appendTo = function (el) { elproto.appendTo = function (el) {
if (el) {
el = wrap(el); el = wrap(el);
el.append(this); el.append(this);
}
return this; return this;
}; };
/*\ /*\
@ -2420,9 +2424,15 @@ function arrayFirstValue(arr) {
= (Element) the parent element = (Element) the parent element
\*/ \*/
elproto.prepend = function (el) { elproto.prepend = function (el) {
if (el) {
el = wrap(el); el = wrap(el);
var parent = el.parent();
this.node.insertBefore(el.node, this.node.firstChild); this.node.insertBefore(el.node, this.node.firstChild);
this.add && this.add();
el.paper = this.paper; el.paper = this.paper;
this.parent() && this.parent().add();
parent && parent.add();
}
return this; return this;
}; };
/*\ /*\
@ -2448,10 +2458,22 @@ function arrayFirstValue(arr) {
- el (Element) element to insert - el (Element) element to insert
= (Element) the parent element = (Element) the parent element
\*/ \*/
// TODO make it work for sets too
elproto.before = function (el) { elproto.before = function (el) {
if (el.type == "set") {
var it = this;
el.forEach(function (el) {
var parent = el.parent();
it.node.parentNode.insertBefore(el.node, it.node);
parent && parent.add();
});
this.parent().add();
return this;
}
el = wrap(el); el = wrap(el);
var parent = el.parent();
this.node.parentNode.insertBefore(el.node, this.node); this.node.parentNode.insertBefore(el.node, this.node);
this.parent() && this.parent().add();
parent && parent.add();
el.paper = this.paper; el.paper = this.paper;
return this; return this;
}; };
@ -2466,7 +2488,14 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.after = function (el) { elproto.after = function (el) {
el = wrap(el); el = wrap(el);
var parent = el.parent();
if (this.node.nextSibling) {
this.node.parentNode.insertBefore(el.node, this.node.nextSibling); this.node.parentNode.insertBefore(el.node, this.node.nextSibling);
} else {
this.node.parentNode.appendChild(el.node);
}
this.parent() && this.parent().add();
parent && parent.add();
el.paper = this.paper; el.paper = this.paper;
return this; return this;
}; };
@ -2481,8 +2510,11 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.insertBefore = function (el) { elproto.insertBefore = function (el) {
el = wrap(el); el = wrap(el);
var parent = this.parent();
el.node.parentNode.insertBefore(this.node, el.node); el.node.parentNode.insertBefore(this.node, el.node);
this.paper = el.paper; this.paper = el.paper;
parent && parent.add();
el.parent() && el.parent().add();
return this; return this;
}; };
/*\ /*\
@ -2496,8 +2528,11 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.insertAfter = function (el) { elproto.insertAfter = function (el) {
el = wrap(el); el = wrap(el);
var parent = this.parent();
el.node.parentNode.insertBefore(this.node, el.node.nextSibling); el.node.parentNode.insertBefore(this.node, el.node.nextSibling);
this.paper = el.paper; this.paper = el.paper;
parent && parent.add();
el.parent() && el.parent().add();
return this; return this;
}; };
/*\ /*\
@ -2508,9 +2543,11 @@ function arrayFirstValue(arr) {
= (Element) the detached element = (Element) the detached element
\*/ \*/
elproto.remove = function () { elproto.remove = function () {
var parent = this.parent();
this.node.parentNode && this.node.parentNode.removeChild(this.node); this.node.parentNode && this.node.parentNode.removeChild(this.node);
delete this.paper; delete this.paper;
this.removed = true; this.removed = true;
parent && parent.add();
return this; return this;
}; };
/*\ /*\
@ -5999,14 +6036,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
if (name == "points") { if (name == "points") {
A = Str(a).split(","); A = Str(a).split(",");
B = Str(b).split(","); B = Str(b).split(",");
// for (var i = 0, ii = Math.max(A.length, B.length); i < ii; i++) {
// if (A[i]) {
// A[i] = +A[i];
// }
// if (B[i]) {
// B[i] = +B[i];
// }
// }
return { return {
from: A, from: A,
to: B, to: B,

View File

@ -3991,7 +3991,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.appendTo"> <article id="Element.appendTo">
<header> <header>
<h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1660 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1660">&#x27ad;</a></h3> <h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1662 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1662">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.appendTo-extra"></div> <div class="extra" id="Element.appendTo-extra"></div>
@ -4051,7 +4051,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.prepend"> <article id="Element.prepend">
<header> <header>
<h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1674 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1674">&#x27ad;</a></h3> <h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1678 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1678">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prepend-extra"></div> <div class="extra" id="Element.prepend-extra"></div>
@ -4111,7 +4111,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.prependTo"> <article id="Element.prependTo">
<header> <header>
<h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1689 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1689">&#x27ad;</a></h3> <h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1699 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1699">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prependTo-extra"></div> <div class="extra" id="Element.prependTo-extra"></div>
@ -4171,7 +4171,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.before"> <article id="Element.before">
<header> <header>
<h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1703 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1703">&#x27ad;</a></h3> <h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1713 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1713">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.before-extra"></div> <div class="extra" id="Element.before-extra"></div>
@ -4231,7 +4231,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.after"> <article id="Element.after">
<header> <header>
<h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1719 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1719">&#x27ad;</a></h3> <h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1741 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1741">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.after-extra"></div> <div class="extra" id="Element.after-extra"></div>
@ -4291,7 +4291,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.insertBefore"> <article id="Element.insertBefore">
<header> <header>
<h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1734 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1734">&#x27ad;</a></h3> <h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1763 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1763">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertBefore-extra"></div> <div class="extra" id="Element.insertBefore-extra"></div>
@ -4351,7 +4351,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.insertAfter"> <article id="Element.insertAfter">
<header> <header>
<h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1749 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1749">&#x27ad;</a></h3> <h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1781 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1781">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertAfter-extra"></div> <div class="extra" id="Element.insertAfter-extra"></div>
@ -4411,7 +4411,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.remove"> <article id="Element.remove">
<header> <header>
<h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1762 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1762">&#x27ad;</a></h3> <h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1797 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1797">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.remove-extra"></div> <div class="extra" id="Element.remove-extra"></div>
@ -4453,7 +4453,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.select"> <article id="Element.select">
<header> <header>
<h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1777 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1777">&#x27ad;</a></h3> <h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1814 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1814">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.select-extra"></div> <div class="extra" id="Element.select-extra"></div>
@ -4513,7 +4513,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.selectAll"> <article id="Element.selectAll">
<header> <header>
<h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1789 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1789">&#x27ad;</a></h3> <h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1826 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1826">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.selectAll-extra"></div> <div class="extra" id="Element.selectAll-extra"></div>
@ -4575,7 +4575,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.asPX"> <article id="Element.asPX">
<header> <header>
<h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1807 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1807">&#x27ad;</a></h3> <h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1844 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1844">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.asPX-extra"></div> <div class="extra" id="Element.asPX-extra"></div>
@ -4638,7 +4638,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.use"> <article id="Element.use">
<header> <header>
<h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1822 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1822">&#x27ad;</a></h3> <h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1859 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1859">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.use-extra"></div> <div class="extra" id="Element.use-extra"></div>
@ -4680,7 +4680,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.clone"> <article id="Element.clone">
<header> <header>
<h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1851 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1851">&#x27ad;</a></h3> <h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1888 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1888">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.clone-extra"></div> <div class="extra" id="Element.clone-extra"></div>
@ -4722,7 +4722,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.toDefs"> <article id="Element.toDefs">
<header> <header>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1931 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1931">&#x27ad;</a></h3> <h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1968 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1968">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toDefs-extra"></div> <div class="extra" id="Element.toDefs-extra"></div>
@ -4764,7 +4764,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.pattern"> <article id="Element.pattern">
<header> <header>
<h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1961 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1961">&#x27ad;</a></h3> <h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1998 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1998">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.pattern-extra"></div> <div class="extra" id="Element.pattern-extra"></div>
@ -4864,7 +4864,7 @@ c.attr({
<article id="Element.marker"> <article id="Element.marker">
<header> <header>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2002 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2002">&#x27ad;</a></h3> <h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2039 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2039">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.marker-extra"></div> <div class="extra" id="Element.marker-extra"></div>
@ -4951,7 +4951,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animation"> <article id="Snap.animation">
<header> <header>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2061 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2061">&#x27ad;</a></h3> <h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2098 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2098">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animation-extra"></div> <div class="extra" id="Snap.animation-extra"></div>
@ -5020,7 +5020,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Element.inAnim"> <article id="Element.inAnim">
<header> <header>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2078 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2078">&#x27ad;</a></h3> <h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2115 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2115">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.inAnim-extra"></div> <div class="extra" id="Element.inAnim-extra"></div>
@ -5114,7 +5114,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animate"> <article id="Snap.animate">
<header> <header>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2127 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2127">&#x27ad;</a></h3> <h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2164 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2164">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animate-extra"></div> <div class="extra" id="Snap.animate-extra"></div>
@ -5275,7 +5275,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.stop"> <article id="Element.stop">
<header> <header>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2145 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2145">&#x27ad;</a></h3> <h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2182 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2182">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.stop-extra"></div> <div class="extra" id="Element.stop-extra"></div>
@ -5317,7 +5317,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.animate"> <article id="Element.animate">
<header> <header>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2166 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2166">&#x27ad;</a></h3> <h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2203 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2203">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.animate-extra"></div> <div class="extra" id="Element.animate-extra"></div>
@ -5386,7 +5386,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.data"> <article id="Element.data">
<header> <header>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2238 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2238">&#x27ad;</a></h3> <h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2275 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2275">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.data-extra"></div> <div class="extra" id="Element.data-extra"></div>
@ -5508,7 +5508,7 @@ with <code>data-</code> attributes)
<article id="Element.removeData"> <article id="Element.removeData">
<header> <header>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2263 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2263">&#x27ad;</a></h3> <h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2300 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2300">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.removeData-extra"></div> <div class="extra" id="Element.removeData-extra"></div>
@ -5569,7 +5569,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.outerSVG"> <article id="Element.outerSVG">
<header> <header>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2280 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2280">&#x27ad;</a></h3> <h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2317 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2317">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.outerSVG-extra"></div> <div class="extra" id="Element.outerSVG-extra"></div>
@ -5612,7 +5612,7 @@ If key is not provided, removes all the data of the element.
<article id="undefined"> <article id="undefined">
<header> <header>
<h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2286 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2286">&#x27ad;</a></h3> <h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2323 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2323">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="undefined-extra"></div> <div class="extra" id="undefined-extra"></div>
@ -5637,7 +5637,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.innerSVG"> <article id="Element.innerSVG">
<header> <header>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2294 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2294">&#x27ad;</a></h3> <h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2331 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2331">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.innerSVG-extra"></div> <div class="extra" id="Element.innerSVG-extra"></div>
@ -5679,7 +5679,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.parse"> <article id="Snap.parse">
<header> <header>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2333 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2333">&#x27ad;</a></h3> <h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2370 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2370">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.parse-extra"></div> <div class="extra" id="Snap.parse-extra"></div>
@ -5739,7 +5739,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.select"> <article id="Fragment.select">
<header> <header>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2365 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2365">&#x27ad;</a></h3> <h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2402 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2402">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.select-extra"></div> <div class="extra" id="Fragment.select-extra"></div>
@ -5764,7 +5764,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.selectAll"> <article id="Fragment.selectAll">
<header> <header>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2372 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2372">&#x27ad;</a></h3> <h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2409 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2409">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.selectAll-extra"></div> <div class="extra" id="Fragment.selectAll-extra"></div>
@ -5789,7 +5789,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.fragment"> <article id="Snap.fragment">
<header> <header>
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2383 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2383">&#x27ad;</a></h3> <h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2420 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2420">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.fragment-extra"></div> <div class="extra" id="Snap.fragment-extra"></div>
@ -5849,7 +5849,7 @@ If key is not provided, removes all the data of the element.
<article id="Paper.el"> <article id="Paper.el">
<header> <header>
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2590 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2590">&#x27ad;</a></h3> <h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2627 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2627">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.el-extra"></div> <div class="extra" id="Paper.el-extra"></div>
@ -5945,7 +5945,7 @@ var c = paper.el("circle", {
<article id="Paper.rect"> <article id="Paper.rect">
<header> <header>
<h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2613 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2613">&#x27ad;</a></h3> <h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2650 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2650">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.rect-extra"></div> <div class="extra" id="Paper.rect-extra"></div>
@ -6045,7 +6045,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.circle"> <article id="Paper.circle">
<header> <header>
<h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2648 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2648">&#x27ad;</a></h3> <h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2685 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2685">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.circle-extra"></div> <div class="extra" id="Paper.circle-extra"></div>
@ -6133,7 +6133,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.image"> <article id="Paper.image">
<header> <header>
<h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2680 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2680">&#x27ad;</a></h3> <h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2717 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2717">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.image-extra"></div> <div class="extra" id="Paper.image-extra"></div>
@ -6255,7 +6255,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.ellipse"> <article id="Paper.ellipse">
<header> <header>
<h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2723 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2723">&#x27ad;</a></h3> <h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2760 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2760">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.ellipse-extra"></div> <div class="extra" id="Paper.ellipse-extra"></div>
@ -6346,7 +6346,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.path"> <article id="Paper.path">
<header> <header>
<h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2768 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2768">&#x27ad;</a></h3> <h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2805 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2805">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.path-extra"></div> <div class="extra" id="Paper.path-extra"></div>
@ -6614,7 +6614,7 @@ Note: there is a special case when a path consists of only three commands: <code
<article id="Paper.g"> <article id="Paper.g">
<header> <header>
<h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2799 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2799">&#x27ad;</a></h3> <h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2836 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2836">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.g-extra"></div> <div class="extra" id="Paper.g-extra"></div>
@ -6723,7 +6723,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.group"> <article id="Paper.group">
<header> <header>
<h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2805 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2805">&#x27ad;</a></h3> <h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2842 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2842">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.group-extra"></div> <div class="extra" id="Paper.group-extra"></div>
@ -6748,7 +6748,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.text"> <article id="Paper.text">
<header> <header>
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2833 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2833">&#x27ad;</a></h3> <h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2870 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2870">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.text-extra"></div> <div class="extra" id="Paper.text-extra"></div>
@ -6837,7 +6837,7 @@ var t2 = paper.text(50, 50, ["S","n","a","p"]);</code></pre></section>
<article id="Paper.line"> <article id="Paper.line">
<header> <header>
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2861 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2861">&#x27ad;</a></h3> <h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2898 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2898">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.line-extra"></div> <div class="extra" id="Paper.line-extra"></div>
@ -6928,7 +6928,7 @@ var t2 = paper.text(50, 50, ["S","n","a","p"]);</code></pre></section>
<article id="Paper.polyline"> <article id="Paper.polyline">
<header> <header>
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2890 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2890">&#x27ad;</a></h3> <h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2927 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2927">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.polyline-extra"></div> <div class="extra" id="Paper.polyline-extra"></div>
@ -7040,7 +7040,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.polygon"> <article id="Paper.polygon">
<header> <header>
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2910 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2910">&#x27ad;</a></h3> <h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2947 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2947">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.polygon-extra"></div> <div class="extra" id="Paper.polygon-extra"></div>
@ -7065,7 +7065,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.gradient"> <article id="Paper.gradient">
<header> <header>
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2963 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2963">&#x27ad;</a></h3> <h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3000 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3000">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.gradient-extra"></div> <div class="extra" id="Paper.gradient-extra"></div>
@ -7263,7 +7263,7 @@ half the width, from black to white:
<article id="Paper.toString"> <article id="Paper.toString">
<header> <header>
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2979 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2979">&#x27ad;</a></h3> <h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3016 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3016">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.toString-extra"></div> <div class="extra" id="Paper.toString-extra"></div>
@ -7305,7 +7305,7 @@ half the width, from black to white:
<article id="Paper.clear"> <article id="Paper.clear">
<header> <header>
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2997 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2997">&#x27ad;</a></h3> <h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3034 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3034">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.clear-extra"></div> <div class="extra" id="Paper.clear-extra"></div>
@ -7330,7 +7330,7 @@ half the width, from black to white:
<article id="Snap.ajax"> <article id="Snap.ajax">
<header> <header>
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3028 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3028">&#x27ad;</a></h3> <h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3065 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3065">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.ajax-extra"></div> <div class="extra" id="Snap.ajax-extra"></div>
@ -7434,7 +7434,7 @@ half the width, from black to white:
<article id="Snap.load"> <article id="Snap.load">
<header> <header>
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3074 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3074">&#x27ad;</a></h3> <h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3111 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3111">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.load-extra"></div> <div class="extra" id="Snap.load-extra"></div>
@ -7483,7 +7483,7 @@ half the width, from black to white:
<article id="Snap.getElementByPoint"> <article id="Snap.getElementByPoint">
<header> <header>
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3503 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3503">&#x27ad;</a></h3> <h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3540 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3540">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.getElementByPoint-extra"></div> <div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -7568,7 +7568,7 @@ half the width, from black to white:
<article id="Snap.plugin"> <article id="Snap.plugin">
<header> <header>
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3538 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3538">&#x27ad;</a></h3> <h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 3575 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3575">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.plugin-extra"></div> <div class="extra" id="Snap.plugin-extra"></div>

View File

@ -1416,8 +1416,8 @@ function add2group(list) {
} }
} }
var children = node.childNodes; var children = node.childNodes;
for (i = 0; i < children.length; i++) if (children[i].snap) { for (i = 0; i < children.length; i++) {
this[j++] = hub[children[i].snap]; this[j++] = wrap(children[i]);
} }
} }
function Element(el) { function Element(el) {
@ -1636,16 +1636,18 @@ function arrayFirstValue(arr) {
* See @Element.append * See @Element.append
\*/ \*/
elproto.append = elproto.add = function (el) { elproto.append = elproto.add = function (el) {
if (el) {
if (el.type == "set") { if (el.type == "set") {
var it = this; var it = this;
el.forEach(function (el) { el.forEach(function (el) {
it.append(el); it.add(el);
}); });
return this; return this;
} }
el = wrap(el); el = wrap(el);
this.node.appendChild(el.node); this.node.appendChild(el.node);
el.paper = this.paper; el.paper = this.paper;
}
return this; return this;
}; };
/*\ /*\
@ -1658,8 +1660,10 @@ function arrayFirstValue(arr) {
= (Element) the child element = (Element) the child element
\*/ \*/
elproto.appendTo = function (el) { elproto.appendTo = function (el) {
if (el) {
el = wrap(el); el = wrap(el);
el.append(this); el.append(this);
}
return this; return this;
}; };
/*\ /*\
@ -1672,9 +1676,15 @@ function arrayFirstValue(arr) {
= (Element) the parent element = (Element) the parent element
\*/ \*/
elproto.prepend = function (el) { elproto.prepend = function (el) {
if (el) {
el = wrap(el); el = wrap(el);
var parent = el.parent();
this.node.insertBefore(el.node, this.node.firstChild); this.node.insertBefore(el.node, this.node.firstChild);
this.add && this.add();
el.paper = this.paper; el.paper = this.paper;
this.parent() && this.parent().add();
parent && parent.add();
}
return this; return this;
}; };
/*\ /*\
@ -1700,10 +1710,22 @@ function arrayFirstValue(arr) {
- el (Element) element to insert - el (Element) element to insert
= (Element) the parent element = (Element) the parent element
\*/ \*/
// TODO make it work for sets too
elproto.before = function (el) { elproto.before = function (el) {
if (el.type == "set") {
var it = this;
el.forEach(function (el) {
var parent = el.parent();
it.node.parentNode.insertBefore(el.node, it.node);
parent && parent.add();
});
this.parent().add();
return this;
}
el = wrap(el); el = wrap(el);
var parent = el.parent();
this.node.parentNode.insertBefore(el.node, this.node); this.node.parentNode.insertBefore(el.node, this.node);
this.parent() && this.parent().add();
parent && parent.add();
el.paper = this.paper; el.paper = this.paper;
return this; return this;
}; };
@ -1718,7 +1740,14 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.after = function (el) { elproto.after = function (el) {
el = wrap(el); el = wrap(el);
var parent = el.parent();
if (this.node.nextSibling) {
this.node.parentNode.insertBefore(el.node, this.node.nextSibling); this.node.parentNode.insertBefore(el.node, this.node.nextSibling);
} else {
this.node.parentNode.appendChild(el.node);
}
this.parent() && this.parent().add();
parent && parent.add();
el.paper = this.paper; el.paper = this.paper;
return this; return this;
}; };
@ -1733,8 +1762,11 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.insertBefore = function (el) { elproto.insertBefore = function (el) {
el = wrap(el); el = wrap(el);
var parent = this.parent();
el.node.parentNode.insertBefore(this.node, el.node); el.node.parentNode.insertBefore(this.node, el.node);
this.paper = el.paper; this.paper = el.paper;
parent && parent.add();
el.parent() && el.parent().add();
return this; return this;
}; };
/*\ /*\
@ -1748,8 +1780,11 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.insertAfter = function (el) { elproto.insertAfter = function (el) {
el = wrap(el); el = wrap(el);
var parent = this.parent();
el.node.parentNode.insertBefore(this.node, el.node.nextSibling); el.node.parentNode.insertBefore(this.node, el.node.nextSibling);
this.paper = el.paper; this.paper = el.paper;
parent && parent.add();
el.parent() && el.parent().add();
return this; return this;
}; };
/*\ /*\
@ -1760,9 +1795,11 @@ function arrayFirstValue(arr) {
= (Element) the detached element = (Element) the detached element
\*/ \*/
elproto.remove = function () { elproto.remove = function () {
var parent = this.parent();
this.node.parentNode && this.node.parentNode.removeChild(this.node); this.node.parentNode && this.node.parentNode.removeChild(this.node);
delete this.paper; delete this.paper;
this.removed = true; this.removed = true;
parent && parent.add();
return this; return this;
}; };
/*\ /*\