Permalink
Browse files

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

…ey are removed upon _destroy()
  • Loading branch information...
gabrielschulhof committed Aug 2, 2012
1 parent 225be4a commit c21100aa9e232fd923e85f976a0f00225797c098
Showing with 4 additions and 20 deletions.
  1. +4 −20 js/widgets/popup.js
View
@@ -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 ) {

0 comments on commit c21100a

Please sign in to comment.