Skip to content

Commit c87615f

Browse files
committed
The function hideSelectionFromResult was tested against undefined as a property and not as a function
1 parent 0f1372c commit c87615f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

select2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,7 +2276,7 @@ the specific language governing permissions and limitations under the Apache Lic
22762276
if (initial === true && selected >= 0) {
22772277
// By default, the selected item is displayed inside the result list from a single select
22782278
// User can provide an implementation for 'hideSelectionFromResult' and hide it
2279-
if(this.opts.hideSelectionFromResult !== undefined && selectedElm !== null) {
2279+
if(selectedElm !== null) {
22802280
if(this.opts.hideSelectionFromResult(selectedElm))
22812281
selectedElm.addClass("select2-selected");
22822282
}
@@ -3008,7 +3008,7 @@ the specific language governing permissions and limitations under the Apache Lic
30083008
// By default, the selected item is hidden from the result list inside a multi select
30093009
// User can provide an implementation for 'hideSelectionFromResult' and allow the same
30103010
// element to be selected multiple times.
3011-
if(self.opts.hideSelectionFromResult === undefined || self.opts.hideSelectionFromResult(choice)) {
3011+
if(self.opts.hideSelectionFromResult(choice) === undefined || self.opts.hideSelectionFromResult(choice)) {
30123012
choice.addClass("select2-selected");
30133013
// mark all children of the selected parent as selected
30143014
choice.find(".select2-result-selectable").addClass("select2-selected");

0 commit comments

Comments
 (0)