Ver Fonte

Fix #181: Fix change event triggered for IE 11 when file input is set to empty

Kartik Visweswaran há 10 anos atrás
pai
commit
22bbcc1643
3 ficheiros alterados com 6 adições e 2 exclusões
  1. 1 0
      CHANGE.md
  2. 5 2
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -10,6 +10,7 @@ version 4.1.8
 6. (enh #177): Trigger filebatchpreupload if showPreview is `false`.
 7. (enh #178): Updated README for cancel button configuration.
 8. (enh #179): Validate and cast `maxFileSize`, `maxFileCount`, and `initialPreviewCount` to numeric - even if they have been setup as a string.
+9. (enh #181): Fix change event triggered for IE 11 when file input is set to empty.
 
 version 4.1.7
 =============

+ 5 - 2
js/fileinput.js

@@ -1539,8 +1539,11 @@
             }
         },
         change: function (e) {
-            var self = this, $el = self.$element, tfiles, msg,
-                total, $preview = self.$preview, isDragDrop = arguments.length > 1,
+            var self = this, $el = self.$element;
+            if (!self.isUploadable && isEmpty($el.val())) { // IE 11 fix
+                return;
+            }
+            var tfiles, msg, total, $preview = self.$preview, isDragDrop = arguments.length > 1,
                 files = isDragDrop ? e.originalEvent.dataTransfer.files : $el.get(0).files,
                 isSingleUpload = isEmpty($el.attr('multiple')),
                 ctr = self.filestack.length, isAjaxUpload = (self.isUploadable && ctr !== 0),

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/fileinput.min.js


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff