PreventDefault on callBack hide function bug
Created by: LuigiOnGitHub
Hi in Bootstrap (v4.0.0-beta): modal.js release I found that the following code in Modal.prototype.hide function (starting line 1982 of bootstrap.js)
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (transition) {
this._isTransitioning = true;
}
should be put after the hideEvent trigger otherwise the property isTransitioning will be true at the next call and therefore a not prevented callback on hide will be inhibited.
correct code starting at line 1982 should be:
var hideEvent = $.Event(Event.HIDE);
$(this._element).trigger(hideEvent);
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return;
}
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (transition) {
this._isTransitioning = true;
}
regards