Skip to content

Commit f8a2a42

Browse files
authored
Fix html5 callback
1 parent 708d416 commit f8a2a42

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/jquery.contextMenu.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,8 +2098,12 @@
20982098
name: $node.text(),
20992099
disabled: !!$node.attr('disabled'),
21002100
callback: (function () {
2101-
return function () {
2102-
$node.get(0).click();
2101+
return function (itemKey, opt, ev) {
2102+
if ($node.get(0).onclick !== null) {
2103+
$node.get(0).click();
2104+
} else {
2105+
opt.callback(itemKey, opt, ev);
2106+
}
21032107
};
21042108
})()
21052109
};
@@ -2117,8 +2121,12 @@
21172121
disabled: !!$node.attr('disabled'),
21182122
icon: $node.attr('icon'),
21192123
callback: (function () {
2120-
return function () {
2121-
$node.get(0).click();
2124+
return function (itemKey, opt, ev) {
2125+
if ($node.get(0).onclick !== null) {
2126+
$node.get(0).click();
2127+
} else {
2128+
opt.callback(itemKey, opt, ev);
2129+
}
21222130
};
21232131
})()
21242132
};

0 commit comments

Comments
 (0)