Skip to content

Commit 08202e8

Browse files
author
Vasil Toshev
committed
Fixed an uncaught error in contextMenu when data('contextMenu') is undefined.
1 parent 186b36e commit 08202e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jquery.contextMenu.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ $.fn.contextMenu = function(operation) {
12221222
} else if (operation.x && operation.y) {
12231223
this.first().trigger($.Event("contextmenu", {pageX: operation.x, pageY: operation.y}));
12241224
} else if (operation === "hide") {
1225-
var $menu = this.data('contextMenu').$menu;
1225+
var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null;
12261226
$menu && $menu.trigger('contextmenu:hide');
12271227
} else if (operation === "destroy") {
12281228
$.contextMenu("destroy", {context: this});

0 commit comments

Comments
 (0)