Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[popup] Use new ._on() binding method to attach handlers such that th…

…ey are removed upon _destroy()
  • Loading branch information...
commit c21100aa9e232fd923e85f976a0f00225797c098 1 parent 225be4a
@gabrielschulhof gabrielschulhof authored
Showing with 4 additions and 20 deletions.
  1. +4 −20 js/widgets/popup.js
View
24 js/widgets/popup.js
@@ -159,16 +159,6 @@ define( [ "jquery",
_tolerance: null,
_resizeData: null,
_orientationchangeInProgress: false,
- _globalHandlers: [
- {
- src: $( window ),
- handler: {
- orientationchange: $.proxy( this, "_handleWindowOrientationchange" ),
- resize: $.proxy( this, "_handleWindowResize" ),
- keyup: $.proxy( this, "_handleWindowKeyUp" )
- }
- }
- ]
});
$.each( this.options, function( key, value ) {
@@ -179,9 +169,10 @@ define( [ "jquery",
});
ui.screen.bind( "vclick", $.proxy( this, "_eatEventAndClose" ) );
-
- $.each( this._globalHandlers, function( idx, value ) {
- value.src.bind( value.handler );
+ this._on( window, {
+ orientationChange: "_handleWindowOrientationChange",
+ resize: "_handleWindowResize",
+ keyup: "_handleWindowKeyUp"
});
},
@@ -579,13 +570,6 @@ define( [ "jquery",
this._ui.screen.remove();
this._ui.container.remove();
this._ui.placeholder.remove();
-
- // Unbind handlers that were bound to elements outside this.element (the window, in this case)
- $.each( this._globalHandlers, function( idx, oneSrc ) {
- $.each( oneSrc.handler, function( eventType, handler ) {
- oneSrc.src.unbind( eventType, handler );
- });
- });
},
open: function( options ) {
Please sign in to comment.
Something went wrong with that request. Please try again.