diff --git a/ionic/animations/animation.ts b/ionic/animations/animation.ts index c88febc0eb..8ff86f6311 100644 --- a/ionic/animations/animation.ts +++ b/ionic/animations/animation.ts @@ -25,13 +25,23 @@ import {extend} from '../util/util'; export class Animation { constructor(ele, opts={}) { - this._el = []; - this._chld = []; - this._ani = []; + this.reset(); this._opts = extend({ renderDelay: 36 }, opts); + this.elements(ele); + + if (!document.documentElement.animate) { + console.error('Web Animations polyfill missing'); + } + } + + reset() { + this._el = []; + this._chld = []; + this._ani = []; + this._bfAdd = []; this._bfSty = {}; this._bfRmv = []; @@ -41,12 +51,6 @@ export class Animation { this._readys = []; this._plays = []; this._finishes = []; - - this.elements(ele); - - if (!document.documentElement.animate) { - console.error('Web Animations polyfill missing'); - } } elements(ele) { @@ -502,7 +506,7 @@ export class Animation { this._ani[i].dispose(); } - this._el = this._parent = this._chld = this._ani = this._readys = this._plays = this._finishes = null; + this.reset(); } /*