Skip to content

Commit

Permalink
make full icon class configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrala committed Aug 30, 2015
1 parent e5fc692 commit 1f68618
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/jquery.contextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,12 @@ var // currently active contextMenu trigger

// add icons
if (item.icon) {
item._icon = ($.isFunction(item.icon)) ? item.icon.call(this, $t, key, item) : item.icon;
$t.addClass("icon icon-" + item._icon);
if($.isFunction(item.icon)){
item._icon = item.icon.call(this, $t, key, item)
} else {
item._icon = "icon icon-" + item.icon;
}
$t.addClass(item._icon);
}
}

Expand Down Expand Up @@ -1189,9 +1193,9 @@ var // currently active contextMenu trigger
$item[disabled ? 'addClass' : 'removeClass']('disabled');

if ($.isFunction(item.icon)) {
$item.removeClass("icon-" + item._icon);
$item.removeClass(item._icon);
item._icon = item.icon.call(this, $trigger, key, item);
$item.addClass("icon-" + item._icon);
$item.addClass(item._icon);
}

if (item.type) {
Expand Down

0 comments on commit 1f68618

Please sign in to comment.