|
12 | 12 | * MIT License http://www.opensource.org/licenses/mit-license
|
13 | 13 | * GPL v3 http://opensource.org/licenses/GPL-3.0
|
14 | 14 | *
|
15 |
| - * Date: 2016-02-14T06:53:14.258Z |
| 15 | + * Date: 2016-02-28T09:41:24.636Z |
16 | 16 | */
|
17 | 17 |
|
18 | 18 | (function (factory) {
|
|
800 | 800 |
|
801 | 801 | // make sure only one item is selected
|
802 | 802 | (opt.$menu ? opt : root).$menu
|
803 |
| - .children(root.classNames.hover).trigger('contextmenu:blur'); |
804 |
| - // Also check this for all siblings of the LI |
805 |
| - $this.siblings().trigger('contextmenu:blur'); |
| 803 | + .children('.' + root.classNames.hover).trigger('contextmenu:blur') |
| 804 | + .children('.hover').trigger('contextmenu:blur'); |
806 | 805 |
|
807 | 806 | if ($this.hasClass(root.classNames.disabled) || $this.hasClass(root.classNames.notSelectable)) {
|
808 | 807 | opt.$selected = null;
|
|
884 | 883 |
|
885 | 884 | $this
|
886 | 885 | .addClass([root.classNames.hover, root.classNames.visible].join(' '))
|
887 |
| - .siblings() |
| 886 | + // select other items and included items |
| 887 | + .parent().find('.context-menu-item').not($this) |
888 | 888 | .removeClass(root.classNames.visible)
|
889 |
| - .filter(root.classNames.hover) |
| 889 | + .filter('.' + root.classNames.hover) |
890 | 890 | .trigger('contextmenu:blur');
|
891 | 891 |
|
892 | 892 | // remember selected
|
|
1018 | 1018 | // remove selected
|
1019 | 1019 | opt.$menu.find('.' + opt.classNames.hover).trigger('contextmenu:blur');
|
1020 | 1020 | opt.$selected = null;
|
| 1021 | + // collapse all submenus |
| 1022 | + opt.$menu.find('.' + opt.classNames.visible).removeClass(opt.classNames.visible); |
1021 | 1023 | // unregister key and mouse handlers
|
1022 | 1024 | // $(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705
|
1023 | 1025 | $(document).off('.contextMenuAutoHide').off('keydown.contextMenu');
|
|
1306 | 1308 | display: '',
|
1307 | 1309 | minWidth: '',
|
1308 | 1310 | maxWidth: ''
|
1309 |
| - }).width(function () { |
| 1311 | + }).outerWidth(function () { |
1310 | 1312 | return $(this).data('width');
|
1311 | 1313 | });
|
1312 | 1314 | }
|
|
0 commit comments