Permalink
Browse files

[loader] Wrap functions bound to events in $.proxy at binding time, a…

…nd pass then unwrapped at unbinding time
  • Loading branch information...
gabrielschulhof committed Oct 4, 2012
1 parent 99b48c5 commit e360e0967aa62f0224e51c9a41487c5a7a277817
Showing with 3 additions and 3 deletions.
  1. +3 −3 js/widgets/loader.js
View
@@ -85,7 +85,7 @@ define( [ "jquery", "../jquery.mobile.core", "../jquery.mobile.widget" ], functi
this.fakeFixLoader();
$window
.unbind( "scroll", this.checkLoaderPosition )
- .bind( "scroll", this.fakeFixLoader );
+ .bind( "scroll", $.proxy( this.fakeFixLoader, this ) );
}
},
@@ -170,8 +170,8 @@ define( [ "jquery", "../jquery.mobile.core", "../jquery.mobile.widget" ], functi
this.element.removeClass( "ui-loader-fakefix" );
}
- $( window ).unbind( "scroll", $.proxy( this.fakeFixLoader, this) );
- $( window ).unbind( "scroll", $.proxy( this.checkLoaderPosition, this ) );
+ $( window ).unbind( "scroll", this.fakeFixLoader );
+ $( window ).unbind( "scroll", this.checkLoaderPosition );
}
});

1 comment on commit e360e09

@DzenisevichK

This comment has been minimized.

Show comment Hide comment
@DzenisevichK

DzenisevichK Oct 5, 2012

@gabrielschulhof

Are you sure that all is correct in this commit?
May be we need:

.bind( "scroll", this.fakeFixLoader = $.proxy( this.fakeFixLoader, this ) );

?

Your variant may work only when unbind have special handling for proxy...

@gabrielschulhof

Are you sure that all is correct in this commit?
May be we need:

.bind( "scroll", this.fakeFixLoader = $.proxy( this.fakeFixLoader, this ) );

?

Your variant may work only when unbind have special handling for proxy...

Please sign in to comment.