Skip to content

Commit 92f70cf

Browse files
committed
Fix #20 confirmation don't show after cancelled with BT >= 3.3.5
1 parent a098346 commit 92f70cf

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

bootstrap-confirmation.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
}
3838
});
3939

40-
// trigger original event on confirm
41-
this.$element.on('confirmed.bs.confirmation', function(e) {
42-
$(this).trigger(that.options.trigger, [true]);
43-
});
44-
4540
// manage singleton
4641
this.$element.on('show.bs.confirmation', function(e) {
4742
if (that.options.singleton) {
@@ -118,6 +113,8 @@
118113

119114
// custom init keeping trace of selectors
120115
Confirmation.prototype.init = function(type, element, options) {
116+
options.trigger = 'click';
117+
121118
$.fn.popover.Constructor.prototype.init.call(this, type, element, options);
122119

123120
this.options._isDelegate = false;
@@ -149,6 +146,7 @@
149146
.one('click', function(e) {
150147
that.getOnConfirm.call(that).call(that.$element);
151148
that.$element.trigger('confirmed.bs.confirmation');
149+
that.$element.trigger(that.options.trigger, [true]);
152150
that.$element.confirmation('hide');
153151
});
154152

@@ -168,6 +166,7 @@
168166
.off('click')
169167
.one('click', function(e) {
170168
that.getOnCancel.call(that).call(that.$element);
169+
if (that.inState) that.inState.click = false; // Bootstrap 3.3.5
171170
that.$element.trigger('canceled.bs.confirmation');
172171
that.$element.confirmation('hide');
173172
});

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@
1010
"homepage": "http://www.strangeplanet.fr"
1111
}
1212
],
13-
"main": "bootstrap-confirmation.js",
14-
"dependencies" : {
15-
"bootstrap": "3.x.x"
16-
},
1713
"devDependencies": {
18-
"grunt": "~0.4.5",
19-
"grunt-contrib-uglify": "~0.4.0",
20-
"grunt-contrib-jshint": "~0.10.0"
14+
"grunt": "^0.4.5",
15+
"grunt-contrib-uglify": "^0.11.0",
16+
"grunt-contrib-jshint": "^0.11.0"
2117
},
2218
"keywords": [
2319
"confirmation",
@@ -32,6 +28,6 @@
3228
"url": "https://github.com/mistic100/Bootstrap-Confirmation/issues"
3329
},
3430
"scripts": {
35-
"test": "grunt test --force"
31+
"test": "grunt test"
3632
}
3733
}

0 commit comments

Comments
 (0)