Upgrade eve.

master
Dmitry Baranovskiy 2014-05-23 21:03:03 +10:00
parent 28119905a5
commit 73ec9f0b53
12 changed files with 265 additions and 172 deletions

File diff suppressed because one or more lines are too long

179
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: 2014-05-22 // build: 2014-05-23
// 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");
@ -38,6 +38,7 @@
var version = "0.4.2", var version = "0.4.2",
has = "hasOwnProperty", has = "hasOwnProperty",
separator = /[\.\/]/, separator = /[\.\/]/,
comaseparator = /\s*,\s*/,
wildcard = "*", wildcard = "*",
fun = function () {}, fun = function () {},
numsort = function (a, b) { numsort = function (a, b) {
@ -46,6 +47,21 @@
current_event, current_event,
stop, stop,
events = {n: {}}, events = {n: {}},
firstDefined = function () {
for (var i = 0, ii = this.length; i < ii; i++) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
lastDefined = function () {
var i = this.length;
while (--i) {
if (typeof this[i] != "undefined") {
return this[i];
}
}
},
/*\ /*\
* eve * eve
[ method ] [ method ]
@ -58,10 +74,10 @@
- scope (object) context for the event handlers - scope (object) context for the event handlers
- varargs (...) the rest of arguments will be sent to event handlers - varargs (...) the rest of arguments will be sent to event handlers
= (object) array of returned values from the listeners = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.
\*/ \*/
eve = function (name, scope) { eve = function (name, scope) {
name = String(name); name = String(name);
var e = events, var e = events,
oldstop = stop, oldstop = stop,
args = Array.prototype.slice.call(arguments, 2), args = Array.prototype.slice.call(arguments, 2),
@ -74,6 +90,8 @@
out = [], out = [],
ce = current_event, ce = current_event,
errors = []; errors = [];
out.firstDefined = firstDefined;
out.lastDefined = lastDefined;
current_event = name; current_event = name;
stop = 0; stop = 0;
for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) { for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) {
@ -119,10 +137,10 @@
} }
stop = oldstop; stop = oldstop;
current_event = ce; current_event = ce;
return out.length ? out : null; return out;
}; };
// Undocumented. Debug only. // Undocumented. Debug only.
eve._events = events; eve._events = events;
/*\ /*\
* eve.listeners * eve.listeners
[ method ] [ method ]
@ -186,27 +204,34 @@
| eve.on("mouse", eatIt)(2); | eve.on("mouse", eatIt)(2);
| eve.on("mouse", scream); | eve.on("mouse", scream);
| eve.on("mouse", catchIt)(1); | eve.on("mouse", catchIt)(1);
* This will ensure that `catchIt()` function will be called before `eatIt()`. * This will ensure that `catchIt` function will be called before `eatIt`.
* *
* If you want to put your handler before non-indexed handlers, specify a negative value. * If you want to put your handler before non-indexed handlers, specify a negative value.
* Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case. * Note: I assume most of the time you dont need to worry about z-index, but its nice to have this feature just in case.
\*/ \*/
eve.on = function (name, f) { eve.on = function (name, f) {
name = String(name); name = String(name);
if (typeof f != "function") { if (typeof f != "function") {
return function () {}; return function () {};
} }
var names = name.split(separator), var names = name.split(comaseparator);
e = events;
for (var i = 0, ii = names.length; i < ii; i++) { for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n; (function (name) {
e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}}); var names = name.split(separator),
e = events,
exist;
for (var i = 0, ii = names.length; i < ii; i++) {
e = e.n;
e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}});
}
e.f = e.f || [];
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
exist = true;
break;
}
!exist && e.f.push(f);
}(names[i]));
} }
e.f = e.f || [];
for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) {
return fun;
}
e.f.push(f);
return function (zIndex) { return function (zIndex) {
if (+zIndex == +zIndex) { if (+zIndex == +zIndex) {
f.zIndex = +zIndex; f.zIndex = +zIndex;
@ -218,23 +243,23 @@
[ method ] [ method ]
** **
* Returns function that will fire given event with optional arguments. * Returns function that will fire given event with optional arguments.
* Arguments that will be passed to the result function will be also * Arguments that will be passed to the result function will be also
* concated to the list of final arguments. * concated to the list of final arguments.
| el.onclick = eve.f("click", 1, 2); | el.onclick = eve.f("click", 1, 2);
| eve.on("click", function (a, b, c) { | eve.on("click", function (a, b, c) {
| console.log(a, b, c); // 1, 2, [event object] | console.log(a, b, c); // 1, 2, [event object]
| }); | });
> Arguments > Arguments
- event (string) event name - event (string) event name
- varargs () and any other arguments - varargs () and any other arguments
= (function) possible event handler function = (function) possible event handler function
\*/ \*/
eve.f = function (event) { eve.f = function (event) {
var attrs = [].slice.call(arguments, 1); var attrs = [].slice.call(arguments, 1);
return function () { return function () {
eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0))); eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0)));
}; };
}; };
/*\ /*\
* eve.stop * eve.stop
[ method ] [ method ]
@ -281,7 +306,7 @@
[ method ] [ method ]
** **
* Removes given function from the list of event listeners assigned to given name. * Removes given function from the list of event listeners assigned to given name.
* If no arguments specified all the events will be cleared. * If no arguments specified all the events will be cleared.
** **
> Arguments > Arguments
** **
@ -295,12 +320,19 @@
* See @eve.off * See @eve.off
\*/ \*/
eve.off = eve.unbind = function (name, f) { eve.off = eve.unbind = function (name, f) {
if (!name) { if (!name) {
eve._events = events = {n: {}}; eve._events = events = {n: {}};
return; return;
} }
var names = name.split(separator), var names = name.split(comaseparator);
e, if (names.length > 1) {
for (var i = 0, ii = names.length; i < ii; i++) {
eve.off(names[i], f);
}
return;
}
names = name.split(separator);
var e,
key, key,
splice, splice,
i, ii, j, jj, i, ii, j, jj,
@ -384,7 +416,7 @@
eve.toString = function () { eve.toString = function () {
return "You are running Eve " + version; return "You are running Eve " + version;
}; };
(typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define != "undefined" ? (define("eve", [], function() { return eve; })) : (glob.eve = eve)); (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define === "function" && define.amd ? (define("eve", [], function() { return eve; })) : (glob.eve = eve));
})(this); })(this);
(function (glob, factory) { (function (glob, factory) {
@ -1774,7 +1806,7 @@ function getSomeSVG(el) {
Snap._.getSomeDefs = getSomeDefs; Snap._.getSomeDefs = getSomeDefs;
Snap._.getSomeSVG = getSomeSVG; Snap._.getSomeSVG = getSomeSVG;
function unit2px(el, name, value) { function unit2px(el, name, value) {
var svg = getSomeSVG(el), var svg = getSomeSVG(el).node,
out = {}, out = {},
mgr = svg.querySelector(".svg---mgr"); mgr = svg.querySelector(".svg---mgr");
if (!mgr) { if (!mgr) {
@ -1973,15 +2005,6 @@ function Element(el) {
} }
} }
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
(function (elproto) { (function (elproto) {
/*\ /*\
* Element.attr * Element.attr
@ -2020,7 +2043,7 @@ function arrayFirstValue(arr) {
json[params] = value; json[params] = value;
params = json; params = json;
} else { } else {
return arrayFirstValue(eve("snap.util.getattr." + params, el)); return eve("snap.util.getattr." + params, el).firstDefined();
} }
} }
for (var att in params) { for (var att in params) {
@ -2057,7 +2080,7 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.getBBox = function (isWithoutTransform) { elproto.getBBox = function (isWithoutTransform) {
if (!Snap.Matrix || !Snap.path) { if (!Snap.Matrix || !Snap.path) {
return this.getBBox(); return this.node.getBBox();
} }
var el = this, var el = this,
m = new Snap.Matrix; m = new Snap.Matrix;
@ -3708,6 +3731,14 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
* Snap.Matrix * Snap.Matrix
[ method ] [ method ]
** **
* Matrix constructor, extend on your own risk.
* To create matrices use @Snap.matrix.
\*/
Snap.Matrix = Matrix;
/*\
* Snap.matrix
[ method ]
**
* Utility method * Utility method
** **
* Returns a matrix based on the given parameters * Returns a matrix based on the given parameters
@ -3721,7 +3752,9 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
- svgMatrix (SVGMatrix) - svgMatrix (SVGMatrix)
= (object) @Matrix = (object) @Matrix
\*/ \*/
Snap.Matrix = Matrix; Snap.matrix = function (a, b, c, d, e, f) {
return new Matrix(a, b, c, d, e, f);
};
}); });
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
@ -4107,15 +4140,15 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
} else { } else {
return; return;
} }
}); })(-1);
eve.on("snap.util.getattr.path", function () { eve.on("snap.util.getattr.path", function () {
var p = $(this.node, "d"); var p = $(this.node, "d");
eve.stop(); eve.stop();
return p; return p;
}); })(-1);
eve.on("snap.util.getattr.class", function () { eve.on("snap.util.getattr.class", function () {
return this.node.className.baseVal; return this.node.className.baseVal;
}); })(-1);
function getFontSize() { function getFontSize() {
eve.stop(); eve.stop();
return this.node.style.fontSize; return this.node.style.fontSize;
@ -4735,17 +4768,8 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
return Snap._.box(cx - r, cy - r, r * 2, r * 2); return Snap._.box(cx - r, cy - r, r * 2, r * 2);
} }
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
function gradient(defs, str) { function gradient(defs, str) {
var grad = arrayFirstValue(eve("snap.util.grad.parse", null, str)), var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
el; el;
if (!grad) { if (!grad) {
return null; return null;
@ -5229,8 +5253,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
di1 = dots1[i + 1], di1 = dots1[i + 1],
dj = dots2[j], dj = dots2[j],
dj1 = dots2[j + 1], dj1 = dots2[j + 1],
ci = abs(di1.x - di.x) < .001 ? "y" : "x", ci = abs(di1.x - di.x) < .0001 ? "y" : "x",
cj = abs(dj1.x - dj.x) < .001 ? "y" : "x", cj = abs(dj1.x - dj.x) < .0001 ? "y" : "x",
is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y); is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
if (is) { if (is) {
if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) { if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {
@ -6736,17 +6760,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return out; return out;
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
Element.prototype.equal = function (name, b) { Element.prototype.equal = function (name, b) {
return arrayFirstValue(eve("snap.util.equal", this, name, b)); return eve("snap.util.equal", this, name, b).firstDefined();
}; };
eve.on("snap.util.equal", function (name, b) { eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""), var A, B, a = Str(this.attr(name) || ""),

View File

@ -611,6 +611,10 @@
<a href="#Snap.load" class="dr-method"><span>Snap.load()</span></a> <a href="#Snap.load" class="dr-method"><span>Snap.load()</span></a>
</li> </li>
<li class="dr-lvl1">
<a href="#Snap.matrix" class="dr-method"><span>Snap.matrix()</span></a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Snap.parse" class="dr-method"><span>Snap.parse()</span></a> <a href="#Snap.parse" class="dr-method"><span>Snap.parse()</span></a>
</li> </li>
@ -2806,7 +2810,7 @@ c.node.onclick = function () {
<article id="Element.attr"> <article id="Element.attr">
<header> <header>
<h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1253 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1253">&#x27ad;</a></h3> <h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1244 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1244">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.attr-extra"></div> <div class="extra" id="Element.attr-extra"></div>
@ -2965,7 +2969,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.getBBox"> <article id="Element.getBBox">
<header> <header>
<h3 class="dr-method">Element.getBBox()<a href="#Element.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1300 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1300">&#x27ad;</a></h3> <h3 class="dr-method">Element.getBBox()<a href="#Element.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1291 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1291">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.getBBox-extra"></div> <div class="extra" id="Element.getBBox-extra"></div>
@ -3147,7 +3151,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.transform"> <article id="Element.transform">
<header> <header>
<h3 class="dr-method">Element.transform(tstr)<a href="#Element.transform" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1360 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1360">&#x27ad;</a></h3> <h3 class="dr-method">Element.transform(tstr)<a href="#Element.transform" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1351 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1351">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.transform-extra"></div> <div class="extra" id="Element.transform-extra"></div>
@ -3311,7 +3315,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.parent"> <article id="Element.parent">
<header> <header>
<h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1417 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1417">&#x27ad;</a></h3> <h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1408 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1408">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.parent-extra"></div> <div class="extra" id="Element.parent-extra"></div>
@ -3353,7 +3357,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.append"> <article id="Element.append">
<header> <header>
<h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1429 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1429">&#x27ad;</a></h3> <h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1420 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1420">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.append-extra"></div> <div class="extra" id="Element.append-extra"></div>
@ -3413,7 +3417,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.add"> <article id="Element.add">
<header> <header>
<h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1435 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1435">&#x27ad;</a></h3> <h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1426 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1426">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.add-extra"></div> <div class="extra" id="Element.add-extra"></div>
@ -3438,7 +3442,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1459 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1459">&#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 1450 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1450">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.appendTo-extra"></div> <div class="extra" id="Element.appendTo-extra"></div>
@ -3498,7 +3502,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1475 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1475">&#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 1466 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1466">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prepend-extra"></div> <div class="extra" id="Element.prepend-extra"></div>
@ -3558,7 +3562,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1509 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1509">&#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 1500 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1500">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prependTo-extra"></div> <div class="extra" id="Element.prependTo-extra"></div>
@ -3618,7 +3622,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1523 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1523">&#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 1514 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1514">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.before-extra"></div> <div class="extra" id="Element.before-extra"></div>
@ -3678,7 +3682,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1551 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1551">&#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 1542 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1542">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.after-extra"></div> <div class="extra" id="Element.after-extra"></div>
@ -3738,7 +3742,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1573 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1573">&#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 1564 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1564">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertBefore-extra"></div> <div class="extra" id="Element.insertBefore-extra"></div>
@ -3798,7 +3802,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1591 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1591">&#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 1582 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1582">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertAfter-extra"></div> <div class="extra" id="Element.insertAfter-extra"></div>
@ -3858,7 +3862,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1607 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1607">&#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 1598 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1598">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.remove-extra"></div> <div class="extra" id="Element.remove-extra"></div>
@ -3900,7 +3904,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1624 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1624">&#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 1615 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1615">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.select-extra"></div> <div class="extra" id="Element.select-extra"></div>
@ -3960,7 +3964,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1636 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1636">&#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 1627 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1627">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.selectAll-extra"></div> <div class="extra" id="Element.selectAll-extra"></div>
@ -4022,7 +4026,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1654 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1654">&#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 1645 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1645">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.asPX-extra"></div> <div class="extra" id="Element.asPX-extra"></div>
@ -4085,7 +4089,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1669 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1669">&#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 1660 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1660">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.use-extra"></div> <div class="extra" id="Element.use-extra"></div>
@ -4127,7 +4131,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1698 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1698">&#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 1689 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1689">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.clone-extra"></div> <div class="extra" id="Element.clone-extra"></div>
@ -4169,7 +4173,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1869 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1869">&#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 1860 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1860">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toDefs-extra"></div> <div class="extra" id="Element.toDefs-extra"></div>
@ -4211,7 +4215,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.pattern"> <article id="Element.pattern">
<header> <header>
<h3 class="dr-method">Element.pattern()<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1880 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1880">&#x27ad;</a></h3> <h3 class="dr-method">Element.pattern()<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1871 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1871">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.pattern-extra"></div> <div class="extra" id="Element.pattern-extra"></div>
@ -4236,7 +4240,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.toPattern"> <article id="Element.toPattern">
<header> <header>
<h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1903 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1903">&#x27ad;</a></h3> <h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1894 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1894">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toPattern-extra"></div> <div class="extra" id="Element.toPattern-extra"></div>
@ -4336,7 +4340,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 1944 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1944">&#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 1935 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1935">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.marker-extra"></div> <div class="extra" id="Element.marker-extra"></div>
@ -4423,7 +4427,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 2003 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2003">&#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 1994 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1994">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animation-extra"></div> <div class="extra" id="Snap.animation-extra"></div>
@ -4492,7 +4496,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 2021 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2021">&#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 2012 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2012">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.inAnim-extra"></div> <div class="extra" id="Element.inAnim-extra"></div>
@ -4594,7 +4598,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 2071 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2071">&#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 2062 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2062">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animate-extra"></div> <div class="extra" id="Snap.animate-extra"></div>
@ -4755,7 +4759,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 2089 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2089">&#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 2080 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2080">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.stop-extra"></div> <div class="extra" id="Element.stop-extra"></div>
@ -4797,7 +4801,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 2108 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2108">&#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 2099 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2099">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.animate-extra"></div> <div class="extra" id="Element.animate-extra"></div>
@ -4866,7 +4870,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 2181 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2181">&#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 2172 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2172">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.data-extra"></div> <div class="extra" id="Element.data-extra"></div>
@ -4988,7 +4992,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 2210 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2210">&#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 2201 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2201">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.removeData-extra"></div> <div class="extra" id="Element.removeData-extra"></div>
@ -5049,7 +5053,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 2227 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2227">&#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 2218 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2218">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.outerSVG-extra"></div> <div class="extra" id="Element.outerSVG-extra"></div>
@ -5092,7 +5096,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.toString"> <article id="Element.toString">
<header> <header>
<h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2233 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2233">&#x27ad;</a></h3> <h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2224 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2224">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toString-extra"></div> <div class="extra" id="Element.toString-extra"></div>
@ -5117,7 +5121,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 2241 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2241">&#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 2232 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2232">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.innerSVG-extra"></div> <div class="extra" id="Element.innerSVG-extra"></div>
@ -5159,7 +5163,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 2279 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2279">&#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 2270 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2270">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.parse-extra"></div> <div class="extra" id="Snap.parse-extra"></div>
@ -5219,7 +5223,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 2311 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2311">&#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 2302 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2302">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.select-extra"></div> <div class="extra" id="Fragment.select-extra"></div>
@ -5244,7 +5248,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 2318 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2318">&#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 2309 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2309">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.selectAll-extra"></div> <div class="extra" id="Fragment.selectAll-extra"></div>
@ -5269,7 +5273,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 2329 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2329">&#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 2320 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2320">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.fragment-extra"></div> <div class="extra" id="Snap.fragment-extra"></div>
@ -5329,7 +5333,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 2432 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2432">&#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 2423 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2423">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.el-extra"></div> <div class="extra" id="Paper.el-extra"></div>
@ -5425,7 +5429,7 @@ var c = paper.el("circle", {
<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 2550 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2550">&#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 2541 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2541">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.ajax-extra"></div> <div class="extra" id="Snap.ajax-extra"></div>
@ -5529,7 +5533,7 @@ var c = paper.el("circle", {
<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 2596 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2596">&#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 2587 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2587">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.load-extra"></div> <div class="extra" id="Snap.load-extra"></div>
@ -5578,7 +5582,7 @@ var c = paper.el("circle", {
<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 2627 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2627">&#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 2618 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2618">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.getElementByPoint-extra"></div> <div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -5663,7 +5667,7 @@ var c = paper.el("circle", {
<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 2662 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2662">&#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 2653 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2653">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.plugin-extra"></div> <div class="extra" id="Snap.plugin-extra"></div>
@ -6382,7 +6386,7 @@ prototypes). This allow you to extend anything you want.
<article id="Snap.Matrix"> <article id="Snap.Matrix">
<header> <header>
<h3 class="dr-method">Snap.Matrix()<a href="#Snap.Matrix" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 298 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L298">&#x27ad;</a></h3> <h3 class="dr-method">Snap.Matrix()<a href="#Snap.Matrix" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 288 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L288">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.Matrix-extra"></div> <div class="extra" id="Snap.Matrix-extra"></div>
@ -6391,6 +6395,32 @@ prototypes). This allow you to extend anything you want.
<p>Matrix constructor, extend on your own risk.
To create matrices use <a href="#Snap.matrix" class="dr-link">Snap.matrix</a>.
</p>
</div>
</section>
</article>
<article id="Snap.matrix">
<header>
<h3 class="dr-method">Snap.matrix(…)<a href="#Snap.matrix" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 306 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L306">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.matrix-extra"></div>
<div class="dr-method">
<p>Utility method <p>Utility method
Returns a matrix based on the given parameters Returns a matrix based on the given parameters
</p> </p>
@ -7905,7 +7935,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 646 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L646">&#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 637 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L637">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.gradient-extra"></div> <div class="extra" id="Paper.gradient-extra"></div>
@ -8103,7 +8133,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 662 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L662">&#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 653 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L653">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.toString-extra"></div> <div class="extra" id="Paper.toString-extra"></div>
@ -8145,7 +8175,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 681 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L681">&#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 672 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L672">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.clear-extra"></div> <div class="extra" id="Paper.clear-extra"></div>

View File

@ -16,7 +16,7 @@
"grunt-exec": "~0.4.2", "grunt-exec": "~0.4.2",
"mocha": "*", "mocha": "*",
"expect.js": "*", "expect.js": "*",
"eve": "*", "eve": "~0.4.2",
"dr.js": "~0.1.0" "dr.js": "~0.1.0"
} }
} }

View File

@ -382,15 +382,15 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
} else { } else {
return; return;
} }
}); })(-1);
eve.on("snap.util.getattr.path", function () { eve.on("snap.util.getattr.path", function () {
var p = $(this.node, "d"); var p = $(this.node, "d");
eve.stop(); eve.stop();
return p; return p;
}); })(-1);
eve.on("snap.util.getattr.class", function () { eve.on("snap.util.getattr.class", function () {
return this.node.className.baseVal; return this.node.className.baseVal;
}); })(-1);
function getFontSize() { function getFontSize() {
eve.stop(); eve.stop();
return this.node.style.fontSize; return this.node.style.fontSize;

View File

@ -103,17 +103,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return out; return out;
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
Element.prototype.equal = function (name, b) { Element.prototype.equal = function (name, b) {
return arrayFirstValue(eve("snap.util.equal", this, name, b)); return eve("snap.util.equal", this, name, b).firstDefined();
}; };
eve.on("snap.util.equal", function (name, b) { eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""), var A, B, a = Str(this.attr(name) || ""),

View File

@ -521,17 +521,8 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
return Snap._.box(cx - r, cy - r, r * 2, r * 2); return Snap._.box(cx - r, cy - r, r * 2, r * 2);
} }
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
function gradient(defs, str) { function gradient(defs, str) {
var grad = arrayFirstValue(eve("snap.util.grad.parse", null, str)), var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
el; el;
if (!grad) { if (!grad) {
return null; return null;

View File

@ -320,8 +320,8 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
di1 = dots1[i + 1], di1 = dots1[i + 1],
dj = dots2[j], dj = dots2[j],
dj1 = dots2[j + 1], dj1 = dots2[j + 1],
ci = abs(di1.x - di.x) < .001 ? "y" : "x", ci = abs(di1.x - di.x) < .0001 ? "y" : "x",
cj = abs(dj1.x - dj.x) < .001 ? "y" : "x", cj = abs(dj1.x - dj.x) < .0001 ? "y" : "x",
is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y); is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
if (is) { if (is) {
if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) { if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) {

View File

@ -1016,7 +1016,7 @@ function getSomeSVG(el) {
Snap._.getSomeDefs = getSomeDefs; Snap._.getSomeDefs = getSomeDefs;
Snap._.getSomeSVG = getSomeSVG; Snap._.getSomeSVG = getSomeSVG;
function unit2px(el, name, value) { function unit2px(el, name, value) {
var svg = getSomeSVG(el), var svg = getSomeSVG(el).node,
out = {}, out = {},
mgr = svg.querySelector(".svg---mgr"); mgr = svg.querySelector(".svg---mgr");
if (!mgr) { if (!mgr) {
@ -1215,15 +1215,6 @@ function Element(el) {
} }
} }
} }
function arrayFirstValue(arr) {
var res;
for (var i = 0, ii = arr.length; i < ii; i++) {
res = res || arr[i];
if (res) {
return res;
}
}
}
(function (elproto) { (function (elproto) {
/*\ /*\
* Element.attr * Element.attr
@ -1262,7 +1253,7 @@ function arrayFirstValue(arr) {
json[params] = value; json[params] = value;
params = json; params = json;
} else { } else {
return arrayFirstValue(eve("snap.util.getattr." + params, el)); return eve("snap.util.getattr." + params, el).firstDefined();
} }
} }
for (var att in params) { for (var att in params) {
@ -1299,7 +1290,7 @@ function arrayFirstValue(arr) {
\*/ \*/
elproto.getBBox = function (isWithoutTransform) { elproto.getBBox = function (isWithoutTransform) {
if (!Snap.Matrix || !Snap.path) { if (!Snap.Matrix || !Snap.path) {
return this.getBBox(); return this.node.getBBox();
} }
var el = this, var el = this,
m = new Snap.Matrix; m = new Snap.Matrix;

75
test.html Normal file
View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 181.4199981689453 189.9199981689453">
<desc>Created with Snap</desc>
<defs>
<rect width="10" height="10" class="svg---mgr"/>
</defs>
<g>
<image xlink:href="http://labels.labellogiclive.com/picnic_12_p1_pic001_uk__v0.svg" preserveAspectRatio="none" x="0" y="0" width="181.42" height="189.92"/>
</g>
<g transform="matrix(1,0,0,1,9.5963,8.3968)">
<g style="cursor: auto;">
<text x="80.28845687866212" y="1.1127823638916006" style="font-family: Helvetica; font-size: 41px; font-style: normal; font-weight: normal; text-decoration: none; text-anchor: middle;">
<tspan space="preserve" x="80.28845687866212" dy="1em">&lt;&lt;title&gt;&gt;</tspan>
</text>
<rect x="0" y="0" width="160.57691375732423" height="49.3193147277832" fill="#ffffff" stroke="#000000" style="fill-opacity: 0; stroke-width: 0.5px; stroke-dasharray: 5px, 2px;"/>
</g>
<line x1="80.28845687866212" x2="80.28845687866212" y1="0" y2="-10" fill="none" stroke="#eeeeee" style="stroke-dasharray: 2px, 2px; stroke-width: 0.7px; visibility: hidden;"/>
<circle cx="80.28845687866212" cy="-10" r="2" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; visibility: hidden;"/>
<rect x="78.28845687866212" y="-2" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: n-resize; visibility: hidden;"/>
<rect x="158.57691375732423" y="22.6596573638916" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: e-resize; visibility: hidden;"/>
<rect x="78.28845687866212" y="47.3193147277832" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: s-resize; visibility: hidden;"/>
<rect x="-2" y="22.6596573638916" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: w-resize; visibility: hidden;"/>
</g>
<g transform="matrix(1,0,0,1,9.5963,59.6773)">
<g style="cursor: auto;">
<text x="80.43839973449704" y="1.263066406250001" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-weight: normal; text-decoration: none; text-anchor: middle;">
<tspan space="preserve" x="80.43839973449704" dy="1em">&lt;&lt;description&gt;&gt;</tspan>
</text>
<rect x="0" y="0" width="160.87679946899408" height="23.229257812500002" fill="#ffffff" stroke="#000000" style="fill-opacity: 0; stroke-width: 0.5px; stroke-dasharray: 5px, 2px;"/>
</g>
<line x1="80.43839973449704" x2="80.43839973449704" y1="0" y2="-10" fill="none" stroke="#eeeeee" style="stroke-dasharray: 2px, 2px; stroke-width: 0.7px; visibility: hidden;"/>
<circle cx="80.43839973449704" cy="-10" r="2" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; visibility: hidden;"/>
<rect x="78.43839973449704" y="-2" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: n-resize; visibility: hidden;"/>
<rect x="158.87679946899408" y="9.614628906250001" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: e-resize; visibility: hidden;"/>
<rect x="78.43839973449704" y="21.229257812500002" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: s-resize; visibility: hidden;"/>
<rect x="-2" y="9.614628906250001" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: w-resize; visibility: hidden;"/>
</g>
<g transform="matrix(1,0,0,1,55.179,84.8677)">
<g style="cursor: auto;">
<text x="24.509714508056643" y="4.783778915405273" style="font-family: Helvetica; font-size: 10px; font-style: normal; font-weight: normal; text-decoration: none; text-anchor: middle;">
<tspan space="preserve" x="24.509714508056643" dy="1em">&lt;&lt;price&gt;&gt;</tspan>
</text>
<rect x="0" y="0" width="49.019429016113286" height="21.130057830810546" fill="#ffffff" stroke="#000000" style="fill-opacity: 0; stroke-width: 0.5px; stroke-dasharray: 5px, 2px;"/>
</g>
<line x1="24.509714508056643" x2="24.509714508056643" y1="0" y2="-10" fill="none" stroke="#eeeeee" style="stroke-dasharray: 2px, 2px; stroke-width: 0.7px; visibility: hidden;"/>
<circle cx="24.509714508056643" cy="-10" r="2" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; visibility: hidden;"/>
<rect x="22.509714508056643" y="-2" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: n-resize; visibility: hidden;"/>
<rect x="47.019429016113286" y="8.565028915405273" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: e-resize; visibility: hidden;"/>
<rect x="22.509714508056643" y="19.130057830810546" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: s-resize; visibility: hidden;"/>
<rect x="-2" y="8.565028915405273" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: w-resize; visibility: hidden;"/>
</g>
<g transform="matrix(1,0,0,1,9.5963,85.1675)">
<g style="cursor: move;">
<text x="21.660800247192384" y="2.757330703735356" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-weight: normal; text-decoration: none; text-anchor: middle;">
<tspan space="preserve" x="21.660800247192384" dy="1em">Use By:</tspan>
</text>
<rect x="0" y="0" width="43.32160049438477" height="20.53028640747071" fill="#ffffff" stroke="#000000" style="fill-opacity: 0; stroke-width: 0.5px; stroke-dasharray: 5px, 2px;"/>
</g>
<line x1="21.660800247192384" x2="21.660800247192384" y1="0" y2="-10" fill="none" stroke="#eeeeee" style="stroke-dasharray: 2px, 2px; stroke-width: 0.7px; visibility: visible;"/>
<circle cx="21.660800247192384" cy="-10" r="2" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; visibility: visible;"/>
<rect x="19.660800247192384" y="-2" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: n-resize; visibility: visible;"/>
<rect x="41.32160049438477" y="8.265143203735356" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: e-resize; visibility: visible;"/>
<rect x="19.660800247192384" y="18.53028640747071" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: s-resize; visibility: visible;"/>
<rect x="-2" y="8.265143203735356" width="4" height="4" fill="#000000" stroke="#eeeeee" style="stroke-width: 0.4px; cursor: w-resize; visibility: visible;"/>
</g>
</svg>
</body>
</html>

View File

@ -15,7 +15,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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.">
<title>Savage Tests</title> <title>Snap Tests</title>
<style media="screen"> <style media="screen">
svg { svg {
position: absolute; position: absolute;