diff --git a/common.blocks/modal/_autoclosable/modal_autoclosable.js b/common.blocks/modal/_autoclosable/modal_autoclosable.js index c19240cbb..9cf1496e4 100644 --- a/common.blocks/modal/_autoclosable/modal_autoclosable.js +++ b/common.blocks/modal/_autoclosable/modal_autoclosable.js @@ -14,15 +14,23 @@ modules.define( */ provide(Modal.declMod({ modName : 'autoclosable', modVal : true }, /** @lends modal.prototype */{ onSetMod : { + 'js' : { + inited : function() { + this.__base.apply(this, arguments); + this._events(this._popup) + .on({ modName : 'visible', modVal : '' }, this._onPopupHide, this); + } + }, 'visible' : { 'true' : function() { this.__base.apply(this, arguments); - - this - ._nextTick(function() { - this._domEvents().on('pointerclick', this._onPointerClick); - }) - ._popup._events().on({ modName : 'visible', modVal : '' }, this._onPopupHide, this); + this._nextTick(function() { + this._domEvents().on('pointerclick', this._onPointerClick); + }); + }, + '' : function() { + this.__base.apply(this, arguments); + this._domEvents().un('pointerclick', this._onPointerClick); } } },