I guess, I was too quick to seek for help (but it does help to write down the problem sometimes).
1> I had to modify the core select2.js to make a selected option accept at least the hover event, or highlight, as select2.js calls it. Somewhere around the line 1542 there is a method findHighlightableChoices. Instead of looking for these
return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
it should not pay attention to already "-selected" classes, so I've made a small change here:
return this.results.find(".select2-result-selectable:not(.select2-disabled)");//:not(.select2-selected)");
2> Now that all elements, including already selected are clickable, I just catch "select2-selecting" event and see, what it is about. If the same element is being selected - remove it from the array and reset array like this:
$('.s2').on('select2-selecting', function(e){
existingVals = $(this).val();
if (!existingVals || existingVals.length == 0) return;
for (a = 0; a<existingVals.length; a++) {
if (existingVals[a] == e.val) {
e.preventDefault();
existingVals[a] = '';
$(this).val(existingVals).trigger('change');
}
}
});
And that's it!
Select2 is just one great plugin.