|
14 | 14 | // See the License for the specific language governing permissions and |
15 | 15 | // limitations under the License. |
16 | 16 | // |
17 | | -// build: 2017-02-07 |
| 17 | +// build: 2021-08-18 |
18 | 18 |
|
19 | | -// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. |
20 | | -// |
| 19 | +// Copyright (c) 2017 Adobe Systems Incorporated. All rights reserved. |
| 20 | +// |
21 | 21 | // Licensed under the Apache License, Version 2.0 (the "License"); |
22 | 22 | // you may not use this file except in compliance with the License. |
23 | 23 | // You may obtain a copy of the License at |
24 | | -// |
| 24 | +// |
25 | 25 | // http://www.apache.org/licenses/LICENSE-2.0 |
26 | | -// |
| 26 | +// |
27 | 27 | // Unless required by applicable law or agreed to in writing, software |
28 | 28 | // distributed under the License is distributed on an "AS IS" BASIS, |
29 | 29 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
30 | 30 | // See the License for the specific language governing permissions and |
31 | 31 | // limitations under the License. |
32 | 32 | // ┌────────────────────────────────────────────────────────────┐ \\ |
33 | | -// │ Eve 0.5.0 - JavaScript Events Library │ \\ |
| 33 | +// │ Eve 0.5.4 - JavaScript Events Library │ \\ |
34 | 34 | // ├────────────────────────────────────────────────────────────┤ \\ |
35 | 35 | // │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\ |
36 | 36 | // └────────────────────────────────────────────────────────────┘ \\ |
37 | 37 |
|
38 | 38 | (function (glob) { |
39 | | - var version = "0.5.0", |
| 39 | + var version = "0.5.4", |
40 | 40 | has = "hasOwnProperty", |
41 | 41 | separator = /[\.\/]/, |
42 | 42 | comaseparator = /\s*,\s*/, |
43 | 43 | wildcard = "*", |
44 | | - fun = function () {}, |
45 | 44 | numsort = function (a, b) { |
46 | 45 | return a - b; |
47 | 46 | }, |
|
67 | 66 | Str = String, |
68 | 67 | isArray = Array.isArray || function (ar) { |
69 | 68 | return ar instanceof Array || objtos.call(ar) == "[object Array]"; |
70 | | - }; |
| 69 | + }, |
71 | 70 | /*\ |
72 | 71 | * eve |
73 | 72 | [ method ] |
74 | 73 |
|
75 | 74 | * Fires event with given `name`, given scope and other parameters. |
76 | 75 |
|
77 | | - > Arguments |
78 | | -
|
79 | 76 | - name (string) name of the *event*, dot (`.`) or slash (`/`) separated |
80 | 77 | - scope (object) context for the event handlers |
81 | 78 | - varargs (...) the rest of arguments will be sent to event handlers |
82 | 79 |
|
83 | 80 | = (object) array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value. |
84 | 81 | \*/ |
85 | 82 | eve = function (name, scope) { |
86 | | - var e = events, |
87 | | - oldstop = stop, |
| 83 | + var oldstop = stop, |
88 | 84 | args = Array.prototype.slice.call(arguments, 2), |
89 | 85 | listeners = eve.listeners(name), |
90 | 86 | z = 0, |
91 | | - f = false, |
92 | 87 | l, |
93 | 88 | indexed = [], |
94 | 89 | queue = {}, |
95 | 90 | out = [], |
96 | | - ce = current_event, |
97 | | - errors = []; |
| 91 | + ce = current_event; |
98 | 92 | out.firstDefined = firstDefined; |
99 | 93 | out.lastDefined = lastDefined; |
100 | 94 | current_event = name; |
|
144 | 138 | current_event = ce; |
145 | 139 | return out; |
146 | 140 | }; |
147 | | - // Undocumented. Debug only. |
148 | | - eve._events = events; |
| 141 | + // Undocumented. Debug only. |
| 142 | + eve._events = events; |
149 | 143 | /*\ |
150 | 144 | * eve.listeners |
151 | 145 | [ method ] |
152 | 146 |
|
153 | 147 | * Internal method which gives you array of all event handlers that will be triggered by the given `name`. |
154 | 148 |
|
155 | | - > Arguments |
156 | | -
|
157 | 149 | - name (string) name of the event, dot (`.`) or slash (`/`) separated |
158 | 150 |
|
159 | 151 | = (array) array of event handlers |
|
223 | 215 | - name (array) if you don’t want to use separators, you can use array of strings |
224 | 216 | - f (function) event handler function |
225 | 217 | ** |
226 | | - = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. |
| 218 | + = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. |
227 | 219 | > Example: |
228 | 220 | | eve.on("mouse", eatIt)(2); |
229 | 221 | | eve.on("mouse", scream); |
|
237 | 229 | if (typeof f != "function") { |
238 | 230 | return function () {}; |
239 | 231 | } |
240 | | - var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator); |
| 232 | + var names = isArray(name) ? isArray(name[0]) ? name : [name] : Str(name).split(comaseparator); |
241 | 233 | for (var i = 0, ii = names.length; i < ii; i++) { |
242 | 234 | (function (name) { |
243 | 235 | var names = isArray(name) ? name : Str(name).split(separator), |
|
272 | 264 | | eve.on("click", function (a, b, c) { |
273 | 265 | | console.log(a, b, c); // 1, 2, [event object] |
274 | 266 | | }); |
275 | | - > Arguments |
276 | 267 | - event (string) event name |
277 | 268 | - varargs (…) and any other arguments |
278 | 269 | = (function) possible event handler function |
|
298 | 289 | ** |
299 | 290 | * Could be used inside event handler to figure out actual name of the event. |
300 | 291 | ** |
301 | | - > Arguments |
302 | | - ** |
303 | 292 | - subname (string) #optional subname of the event |
304 | 293 | ** |
305 | 294 | = (string) name of the event, if `subname` is not specified |
|
332 | 321 | * Removes given function from the list of event listeners assigned to given name. |
333 | 322 | * If no arguments specified all the events will be cleared. |
334 | 323 | ** |
335 | | - > Arguments |
336 | | - ** |
337 | 324 | - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards |
338 | 325 | - f (function) event handler function |
339 | 326 | \*/ |
|
348 | 335 | eve._events = events = {n: {}}; |
349 | 336 | return; |
350 | 337 | } |
351 | | - var names = isArray(name) ? (isArray(name[0]) ? name : [name]) : Str(name).split(comaseparator); |
| 338 | + var names = isArray(name) ? isArray(name[0]) ? name : [name] : Str(name).split(comaseparator); |
352 | 339 | if (names.length > 1) { |
353 | 340 | for (var i = 0, ii = names.length; i < ii; i++) { |
354 | 341 | eve.off(names[i], f); |
|
439 | 426 | | eve("login"); // no listeners |
440 | 427 | * Use @eve to trigger the listener. |
441 | 428 | ** |
442 | | - > Arguments |
443 | | - ** |
444 | 429 | - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards |
445 | 430 | - f (function) event handler function |
446 | 431 | ** |
|
463 | 448 | eve.toString = function () { |
464 | 449 | return "You are running Eve " + version; |
465 | 450 | }; |
466 | | - (typeof module != "undefined" && module.exports) ? (module.exports = eve) : (typeof define === "function" && define.amd ? (define("eve", [], function() { return eve; })) : (glob.eve = eve)); |
467 | | -})(this); |
| 451 | + glob.eve = eve; |
| 452 | + typeof module != "undefined" && module.exports ? module.exports = eve : typeof define === "function" && define.amd ? define("eve", [], function () { return eve; }) : glob.eve = eve; |
| 453 | +})(typeof window != "undefined" ? window : this); |
468 | 454 |
|
469 | 455 | (function (glob, factory) { |
470 | 456 | // AMD support |
@@ -2178,7 +2164,7 @@ setInterval(function () { |
2178 | 2164 | for (var key in hub) if (hub[has](key)) { |
2179 | 2165 | var el = hub[key], |
2180 | 2166 | node = el.node; |
2181 | | - if (el.type != "svg" && !node.ownerSVGElement || el.type == "svg" && (!node.parentNode || "ownerSVGElement" in node.parentNode && !node.ownerSVGElement)) { |
| 2167 | + if (!node.isConnected) { |
2182 | 2168 | delete hub[key]; |
2183 | 2169 | } |
2184 | 2170 | } |
@@ -7614,7 +7600,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) { |
7614 | 7600 | Snap.plugin(function (Snap, Element, Paper, glob) { |
7615 | 7601 | var elproto = Element.prototype, |
7616 | 7602 | has = "hasOwnProperty", |
7617 | | - supportsTouch = "createTouch" in glob.doc, |
| 7603 | + supportsTouch = (('ontouchstart' in window) || window.TouchEvent || window.DocumentTouch && document instanceof DocumentTouch), |
7618 | 7604 | events = [ |
7619 | 7605 | "click", "dblclick", "mousedown", "mousemove", "mouseout", |
7620 | 7606 | "mouseover", "mouseup", "touchstart", "touchmove", "touchend", |
|
0 commit comments