From ff935c396c432afbac9899193c1dbcaf649eabb4 Mon Sep 17 00:00:00 2001 From: Dehalion Date: Mon, 23 Mar 2015 15:10:21 +0100 Subject: [PATCH 1/2] give `e` as parameter for this.clear() this.clear() expects the event object as parameter if it is triggered by the user otherwise it won't trigger the 'clear.bs.fileinput' event --- js/fileinput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/fileinput.js b/js/fileinput.js index f4a9d973..00b3d590 100644 --- a/js/fileinput.js +++ b/js/fileinput.js @@ -66,7 +66,7 @@ e.stopPropagation() if (files.length === 0) { - this.clear() + this.clear(e) return } From cb97fb59be875bbc02af68a89089c4d1e459ae16 Mon Sep 17 00:00:00 2001 From: Dehalion Date: Mon, 23 Mar 2015 15:23:42 +0100 Subject: [PATCH 2/2] trigger clear.bs.fileinput event if user cancels this.clear() expects the event object as parameter otherwise it won't trigger the 'clear.bs.fileinput' event so we have to trigger it ourselves --- js/fileinput.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/fileinput.js b/js/fileinput.js index 00b3d590..c2bd5f04 100644 --- a/js/fileinput.js +++ b/js/fileinput.js @@ -66,7 +66,8 @@ e.stopPropagation() if (files.length === 0) { - this.clear(e) + this.clear() + this.$element.trigger('clear.bs.fileinput') return }