joomla/joomla-cms — pull request #4032 by itbra (2014-07-29 13:02:02+00:00)
Title: Fix add/remove selected attribute and class

Currently the chosen.jquery plugin doesn't properly handle the adding/removing of the class `'result-selected'` and attribute `'selected="selected"'` when list elements are changed (single-select-list) or added/removed (multi-select-list). Its current implementation leaves the class `'result-selected'` attached to any previously selected list element thus making to handle the specific selected item by an onchange-handler impossible when trying to catch the selected element via its `'result-selected'` class.

The fix solves this issue and properly adds/removes the mentioned class and attribute to every involved element and allows to post-process exactly only the currently selected element(s) by an onchange-handler.