Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/jquery.contextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,10 @@
e.preventDefault();
e.stopImmediatePropagation();

if ($.isFunction(opt.callbacks[key]) && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {
if ((typeof opt.callbacks[key] === 'function') && Object.prototype.hasOwnProperty.call(opt.callbacks, key)) {
// item-specific callback
callback = opt.callbacks[key];
} else if ($.isFunction(root.callback)) {
} else if (typeof root.callback === 'function') {
// default callback
callback = root.callback;
} else {
Expand Down Expand Up @@ -1300,7 +1300,7 @@
k.commands[key] = item;
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {
if ((typeof item.callback === 'function') && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {
k.callbacks[key] = item.callback;
}
});
Expand Down Expand Up @@ -1405,7 +1405,7 @@
k.commands[key] = item;
// Overwrite only if undefined or the item is appended to the root. This so it
// doesn't overwrite callbacks of root elements if the name is the same.
if ($.isFunction(item.callback) && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {
if ((typeof item.callback === 'function') && (typeof k.callbacks[key] === 'undefined' || typeof opt.type === 'undefined')) {
k.callbacks[key] = item.callback;
}
});
Expand All @@ -1426,7 +1426,7 @@

// add icons
if (item.icon) {
if ($.isFunction(item.icon)) {
if (typeof item.icon === 'function') {
item._icon = item.icon.call(this, this, $t, key, item);
} else {
if (typeof(item.icon) === 'string' && (
Expand Down Expand Up @@ -1525,9 +1525,9 @@
var $item = $(this),
key = $item.data('contextMenuKey'),
item = opt.items[key],
disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true,
disabled = ((typeof item.disabled === 'function') && item.disabled.call($trigger, key, root)) || item.disabled === true,
visible;
if ($.isFunction(item.visible)) {
if (typeof item.visible === 'function') {
visible = item.visible.call($trigger, key, root);
} else if (typeof item.visible !== 'undefined') {
visible = item.visible === true;
Expand All @@ -1544,7 +1544,7 @@
// dis- / enable item
$item[disabled ? 'addClass' : 'removeClass'](root.classNames.disabled);

if ($.isFunction(item.icon)) {
if (typeof item.icon === 'function') {
$item.removeClass(item._icon);
var iconResult = item.icon.call(this, $trigger, $item, key, item);
if(typeof(iconResult) === "string"){
Expand Down