@@ -94,7 +94,7 @@ $.widget("moogle.contextmenu", {
94
94
}
95
95
// TODO: the selectstart is not supported by FF?
96
96
if ( supportSelectstart ) {
97
- this . element . delegate ( opts . delegate , "selectstart" + this . eventNamespace ,
97
+ this . element . on ( "selectstart" + this . eventNamespace , opts . delegate ,
98
98
function ( event ) {
99
99
event . preventDefault ( ) ;
100
100
} ) ;
@@ -106,11 +106,11 @@ $.widget("moogle.contextmenu", {
106
106
if ( opts . taphold ) {
107
107
eventNames += " taphold" + this . eventNamespace ;
108
108
}
109
- this . element . delegate ( opts . delegate , eventNames , $ . proxy ( this . _openMenu , this ) ) ;
109
+ this . element . on ( eventNames , opts . delegate , $ . proxy ( this . _openMenu , this ) ) ;
110
110
} ,
111
111
/** Destructor, called on $().contextmenu("destroy"). */
112
112
_destroy : function ( ) {
113
- this . element . undelegate ( this . eventNamespace ) ;
113
+ this . element . off ( this . eventNamespace ) ;
114
114
115
115
this . _createUiMenu ( null ) ;
116
116
@@ -230,11 +230,11 @@ $.widget("moogle.contextmenu", {
230
230
}
231
231
232
232
// Register global event handlers that close the dropdown-menu
233
- $ ( document ) . bind ( "keydown" + this . eventNamespace , function ( event ) {
233
+ $ ( document ) . on ( "keydown" + this . eventNamespace , function ( event ) {
234
234
if ( event . which === $ . ui . keyCode . ESCAPE ) {
235
235
self . _closeMenu ( ) ;
236
236
}
237
- } ) . bind ( "mousedown" + this . eventNamespace + " touchstart" + this . eventNamespace ,
237
+ } ) . on ( "mousedown" + this . eventNamespace + " touchstart" + this . eventNamespace ,
238
238
function ( event ) {
239
239
// Close menu when clicked outside menu
240
240
if ( ! $ ( event . target ) . closest ( ".ui-menu-item" ) . length ) {
@@ -265,7 +265,7 @@ $.widget("moogle.contextmenu", {
265
265
. hide ( ) ; // hide again, so we can apply nice effects
266
266
267
267
if ( opts . preventContextMenuForPopup ) {
268
- this . $menu . bind ( "contextmenu" + this . eventNamespace , function ( event ) {
268
+ this . $menu . on ( "contextmenu" + this . eventNamespace , function ( event ) {
269
269
event . preventDefault ( ) ;
270
270
} ) ;
271
271
}
@@ -288,15 +288,15 @@ $.widget("moogle.contextmenu", {
288
288
289
289
// Note: we don't want to unbind the 'contextmenu' event
290
290
$ ( document )
291
- . unbind ( "mousedown" + this . eventNamespace )
292
- . unbind ( "touchstart" + this . eventNamespace )
293
- . unbind ( "keydown" + this . eventNamespace ) ;
291
+ . off ( "mousedown" + this . eventNamespace )
292
+ . off ( "touchstart" + this . eventNamespace )
293
+ . off ( "keydown" + this . eventNamespace ) ;
294
294
295
295
self . currentTarget = null ; // issue #44 after hide animation is too late
296
296
self . extraData = { } ;
297
297
if ( this . $menu ) { // #88: widget might have been destroyed already
298
298
this . $menu
299
- . unbind ( "contextmenu" + this . eventNamespace ) ;
299
+ . off ( "contextmenu" + this . eventNamespace ) ;
300
300
this . _hide ( this . $menu , hideOpts , function ( ) {
301
301
if ( self . previousFocus ) {
302
302
self . previousFocus . focus ( ) ;
0 commit comments