Skip to content

Commit 979194e

Browse files
chore(all): prepare release 1.0.1
1 parent b8fdb55 commit 979194e

File tree

9 files changed

+178
-8
lines changed

9 files changed

+178
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aurelia-animator-css",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "An implementation of the abstract Animator interface from templating which enables css-based animations.",
55
"keywords": [
66
"aurelia",

dist/amd/aurelia-animator-css.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
2828
}
2929
};
3030

31+
CssAnimator.prototype._removeMultipleEventListener = function _removeMultipleEventListener(el, s, fn) {
32+
var evts = s.split(' ');
33+
for (var i = 0, ii = evts.length; i < ii; ++i) {
34+
el.removeEventListener(evts[i], fn, false);
35+
}
36+
};
37+
3138
CssAnimator.prototype._getElementAnimationDelay = function _getElementAnimationDelay(element) {
3239
var styl = _aureliaPal.DOM.getComputedStyle(element);
3340
var prop = void 0;
@@ -111,7 +118,11 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
111118

112119
try {
113120
for (var i = 0; i < styleSheets.length; ++i) {
114-
var cssRules = styleSheets[i].cssRules;
121+
var cssRules = null;
122+
123+
try {
124+
cssRules = styleSheets[i].cssRules;
125+
} catch (e) {}
115126

116127
if (!cssRules) {
117128
continue;
@@ -218,6 +229,10 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
218229
if (!_this4._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
219230
classList.remove('au-enter-active');
220231
classList.remove('au-enter');
232+
233+
_this4._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd);
234+
_this4._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart);
235+
221236
_this4._triggerDOMEvent(_aureliaTemplating.animationEvent.enterTimeout, element);
222237
resolve(false);
223238
}
@@ -300,6 +315,10 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
300315
if (!_this5._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
301316
classList.remove('au-leave-active');
302317
classList.remove('au-leave');
318+
319+
_this5._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd2);
320+
_this5._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart2);
321+
303322
_this5._triggerDOMEvent(_aureliaTemplating.animationEvent.leaveTimeout, element);
304323
resolve(false);
305324
}
@@ -385,6 +404,9 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
385404
classList.remove(className + '-remove');
386405
classList.remove(className);
387406

407+
_this6._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd3);
408+
_this6._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart3);
409+
388410
if (suppressEvents !== true) {
389411
_this6._triggerDOMEvent(_aureliaTemplating.animationEvent.removeClassTimeout, element);
390412
}
@@ -453,6 +475,9 @@ define(['exports', 'aurelia-templating', 'aurelia-pal'], function (exports, _aur
453475
classList.remove(className + '-add');
454476
classList.add(className);
455477

478+
_this7._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd4);
479+
_this7._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart4);
480+
456481
if (suppressEvents !== true) {
457482
_this7._triggerDOMEvent(_aureliaTemplating.animationEvent.addClassTimeout, element);
458483
}

dist/aurelia-animator-css.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ export class CssAnimator {
3737
}
3838
}
3939

40+
/**
41+
* Remove multiple listeners at once from the given element
42+
*
43+
* @param el the element
44+
* @param s collection of events to remove
45+
* @param fn callback to remove
46+
*/
47+
_removeMultipleEventListener(el: HTMLElement, s: string, fn: Function) : void {
48+
let evts = s.split(' ');
49+
for (let i = 0, ii = evts.length; i < ii; ++i) {
50+
el.removeEventListener(evts[i], fn, false);
51+
}
52+
}
53+
4054
/**
4155
* Vendor-prefix save method to get the animation-delay
4256
*
@@ -153,7 +167,13 @@ export class CssAnimator {
153167

154168
try {
155169
for (let i = 0; i < styleSheets.length; ++i) {
156-
let cssRules = styleSheets[i].cssRules;
170+
let cssRules = null;
171+
172+
try {
173+
cssRules = styleSheets[i].cssRules;
174+
} catch (e) {
175+
// do nothing
176+
}
157177

158178
if (!cssRules) {
159179
continue;
@@ -285,6 +305,10 @@ export class CssAnimator {
285305
if (! this._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
286306
classList.remove('au-enter-active');
287307
classList.remove('au-enter');
308+
309+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
310+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
311+
288312
this._triggerDOMEvent(animationEvent.enterTimeout, element);
289313
resolve(false);
290314
}
@@ -389,6 +413,10 @@ export class CssAnimator {
389413
if (! this._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
390414
classList.remove('au-leave-active');
391415
classList.remove('au-leave');
416+
417+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
418+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
419+
392420
this._triggerDOMEvent(animationEvent.leaveTimeout, element);
393421
resolve(false);
394422
}
@@ -492,6 +520,9 @@ export class CssAnimator {
492520
classList.remove(className + '-remove');
493521
classList.remove(className);
494522

523+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
524+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
525+
495526
if (suppressEvents !== true) {
496527
this._triggerDOMEvent(animationEvent.removeClassTimeout, element);
497528
}
@@ -572,6 +603,9 @@ export class CssAnimator {
572603
classList.remove(className + '-add');
573604
classList.add(className);
574605

606+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
607+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
608+
575609
if (suppressEvents !== true) {
576610
this._triggerDOMEvent(animationEvent.addClassTimeout, element);
577611
}

dist/commonjs/aurelia-animator-css.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ var CssAnimator = exports.CssAnimator = function () {
3131
}
3232
};
3333

34+
CssAnimator.prototype._removeMultipleEventListener = function _removeMultipleEventListener(el, s, fn) {
35+
var evts = s.split(' ');
36+
for (var i = 0, ii = evts.length; i < ii; ++i) {
37+
el.removeEventListener(evts[i], fn, false);
38+
}
39+
};
40+
3441
CssAnimator.prototype._getElementAnimationDelay = function _getElementAnimationDelay(element) {
3542
var styl = _aureliaPal.DOM.getComputedStyle(element);
3643
var prop = void 0;
@@ -114,7 +121,11 @@ var CssAnimator = exports.CssAnimator = function () {
114121

115122
try {
116123
for (var i = 0; i < styleSheets.length; ++i) {
117-
var cssRules = styleSheets[i].cssRules;
124+
var cssRules = null;
125+
126+
try {
127+
cssRules = styleSheets[i].cssRules;
128+
} catch (e) {}
118129

119130
if (!cssRules) {
120131
continue;
@@ -221,6 +232,10 @@ var CssAnimator = exports.CssAnimator = function () {
221232
if (!_this4._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
222233
classList.remove('au-enter-active');
223234
classList.remove('au-enter');
235+
236+
_this4._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd);
237+
_this4._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart);
238+
224239
_this4._triggerDOMEvent(_aureliaTemplating.animationEvent.enterTimeout, element);
225240
resolve(false);
226241
}
@@ -303,6 +318,10 @@ var CssAnimator = exports.CssAnimator = function () {
303318
if (!_this5._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
304319
classList.remove('au-leave-active');
305320
classList.remove('au-leave');
321+
322+
_this5._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd2);
323+
_this5._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart2);
324+
306325
_this5._triggerDOMEvent(_aureliaTemplating.animationEvent.leaveTimeout, element);
307326
resolve(false);
308327
}
@@ -388,6 +407,9 @@ var CssAnimator = exports.CssAnimator = function () {
388407
classList.remove(className + '-remove');
389408
classList.remove(className);
390409

410+
_this6._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd3);
411+
_this6._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart3);
412+
391413
if (suppressEvents !== true) {
392414
_this6._triggerDOMEvent(_aureliaTemplating.animationEvent.removeClassTimeout, element);
393415
}
@@ -456,6 +478,9 @@ var CssAnimator = exports.CssAnimator = function () {
456478
classList.remove(className + '-add');
457479
classList.add(className);
458480

481+
_this7._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd4);
482+
_this7._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart4);
483+
459484
if (suppressEvents !== true) {
460485
_this7._triggerDOMEvent(_aureliaTemplating.animationEvent.addClassTimeout, element);
461486
}

dist/es2015/aurelia-animator-css.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export let CssAnimator = class CssAnimator {
1818
}
1919
}
2020

21+
_removeMultipleEventListener(el, s, fn) {
22+
let evts = s.split(' ');
23+
for (let i = 0, ii = evts.length; i < ii; ++i) {
24+
el.removeEventListener(evts[i], fn, false);
25+
}
26+
}
27+
2128
_getElementAnimationDelay(element) {
2229
let styl = DOM.getComputedStyle(element);
2330
let prop;
@@ -97,7 +104,11 @@ export let CssAnimator = class CssAnimator {
97104

98105
try {
99106
for (let i = 0; i < styleSheets.length; ++i) {
100-
let cssRules = styleSheets[i].cssRules;
107+
let cssRules = null;
108+
109+
try {
110+
cssRules = styleSheets[i].cssRules;
111+
} catch (e) {}
101112

102113
if (!cssRules) {
103114
continue;
@@ -198,6 +209,10 @@ export let CssAnimator = class CssAnimator {
198209
if (!this._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
199210
classList.remove('au-enter-active');
200211
classList.remove('au-enter');
212+
213+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
214+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
215+
201216
this._triggerDOMEvent(animationEvent.enterTimeout, element);
202217
resolve(false);
203218
}
@@ -278,6 +293,10 @@ export let CssAnimator = class CssAnimator {
278293
if (!this._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
279294
classList.remove('au-leave-active');
280295
classList.remove('au-leave');
296+
297+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
298+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
299+
281300
this._triggerDOMEvent(animationEvent.leaveTimeout, element);
282301
resolve(false);
283302
}
@@ -359,6 +378,9 @@ export let CssAnimator = class CssAnimator {
359378
classList.remove(className + '-remove');
360379
classList.remove(className);
361380

381+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
382+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
383+
362384
if (suppressEvents !== true) {
363385
this._triggerDOMEvent(animationEvent.removeClassTimeout, element);
364386
}
@@ -423,6 +445,9 @@ export let CssAnimator = class CssAnimator {
423445
classList.remove(className + '-add');
424446
classList.add(className);
425447

448+
this._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', animEnd);
449+
this._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', animStart);
450+
426451
if (suppressEvents !== true) {
427452
this._triggerDOMEvent(animationEvent.addClassTimeout, element);
428453
}

dist/native-modules/aurelia-animator-css.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ export var CssAnimator = function () {
2222
}
2323
};
2424

25+
CssAnimator.prototype._removeMultipleEventListener = function _removeMultipleEventListener(el, s, fn) {
26+
var evts = s.split(' ');
27+
for (var i = 0, ii = evts.length; i < ii; ++i) {
28+
el.removeEventListener(evts[i], fn, false);
29+
}
30+
};
31+
2532
CssAnimator.prototype._getElementAnimationDelay = function _getElementAnimationDelay(element) {
2633
var styl = DOM.getComputedStyle(element);
2734
var prop = void 0;
@@ -105,7 +112,11 @@ export var CssAnimator = function () {
105112

106113
try {
107114
for (var i = 0; i < styleSheets.length; ++i) {
108-
var cssRules = styleSheets[i].cssRules;
115+
var cssRules = null;
116+
117+
try {
118+
cssRules = styleSheets[i].cssRules;
119+
} catch (e) {}
109120

110121
if (!cssRules) {
111122
continue;
@@ -212,6 +223,10 @@ export var CssAnimator = function () {
212223
if (!_this4._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
213224
classList.remove('au-enter-active');
214225
classList.remove('au-enter');
226+
227+
_this4._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd);
228+
_this4._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart);
229+
215230
_this4._triggerDOMEvent(animationEvent.enterTimeout, element);
216231
resolve(false);
217232
}
@@ -294,6 +309,10 @@ export var CssAnimator = function () {
294309
if (!_this5._animationChangeWithValidKeyframe(animationNames, prevAnimationNames)) {
295310
classList.remove('au-leave-active');
296311
classList.remove('au-leave');
312+
313+
_this5._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd2);
314+
_this5._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart2);
315+
297316
_this5._triggerDOMEvent(animationEvent.leaveTimeout, element);
298317
resolve(false);
299318
}
@@ -379,6 +398,9 @@ export var CssAnimator = function () {
379398
classList.remove(className + '-remove');
380399
classList.remove(className);
381400

401+
_this6._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd3);
402+
_this6._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart3);
403+
382404
if (suppressEvents !== true) {
383405
_this6._triggerDOMEvent(animationEvent.removeClassTimeout, element);
384406
}
@@ -447,6 +469,9 @@ export var CssAnimator = function () {
447469
classList.remove(className + '-add');
448470
classList.add(className);
449471

472+
_this7._removeMultipleEventListener(element, 'webkitAnimationEnd animationend', _animEnd4);
473+
_this7._removeMultipleEventListener(element, 'webkitAnimationStart animationstart', _animStart4);
474+
450475
if (suppressEvents !== true) {
451476
_this7._triggerDOMEvent(animationEvent.addClassTimeout, element);
452477
}

0 commit comments

Comments
 (0)