Skip to content

Commit

Permalink
grunt dist
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol committed May 28, 2015
1 parent 7531edf commit 9da682f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
19 changes: 17 additions & 2 deletions dist/js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@
return r
};
}

$.fn.triggerNative = function (eventName) {
var event;

if (typeof Event === 'function') {
// For modern browsers
event = new Event(eventName);
} else {
// For IE since it doesn't support Event constructor
event = document.createEvent('Event');
event.initEvent(eventName);
}

this[0].dispatchEvent(event);
};
//</editor-fold>

// Case insensitive contains search
Expand Down Expand Up @@ -1117,7 +1132,7 @@

// Trigger select 'change'
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
that.$element.change();
that.$element.triggerNative('change');
// $option.prop('selected') is current option state (selected/unselected). state is previous option state.
that.$element.trigger('changed.bs.select', [clickedIndex, $option.prop('selected'), state]);
}
Expand Down Expand Up @@ -1169,7 +1184,7 @@
} else {
that.deselectAll();
}
that.$element.change();
that.$element.triggerNative('change');
});

this.$element.change(function () {
Expand Down
Loading

0 comments on commit 9da682f

Please sign in to comment.