Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
crlcu committed Mar 19, 2017
2 parents d3933c9 + fc774f6 commit 8b0eb36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions dist/js/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,28 +392,26 @@ if (typeof jQuery === 'undefined') {
return true;
}

var shouldMove = true;

if ($option.is('optgroup') || $option.parent().is('optgroup')) {
var $sourceGroup = $option.is('optgroup') ? $option : $option.parent();
var optgroupSelector = 'optgroup[' + self.options.matchOptgroupBy + '="' + $sourceGroup.prop(self.options.matchOptgroupBy) + '"]';
var $destinationGroup = $destination.find(optgroupSelector);

shouldMove = false;

if (!$destinationGroup.length) {
shouldMove = true;

$destinationGroup = $sourceGroup.clone();
$destinationGroup.children().remove();
$destinationGroup = $sourceGroup.clone(true);
$destinationGroup.empty();

$destination.move($destinationGroup);
}

$option = $destinationGroup.append($option);
if ($option.is('optgroup')) {
$destinationGroup.move($option.find('option'));
} else {
$destinationGroup.move($option);
}

$sourceGroup.removeIfEmpty();
}

if (shouldMove) {
} else {
$destination.move($option);
}
});
Expand Down
2 changes: 1 addition & 1 deletion dist/js/multiselect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8b0eb36

Please sign in to comment.