Skip to content

Commit

Permalink
Removed file normalization, dropping support for Gecko < 1.9.2 (Firef…
Browse files Browse the repository at this point in the history
…ox < 3.6).
  • Loading branch information
blueimp committed Aug 10, 2012
1 parent 8438d59 commit 788a49d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
21 changes: 5 additions & 16 deletions js/jquery.fileupload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin 5.14
* jQuery File Upload Plugin 5.15
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -751,14 +751,6 @@
return result;
},

// File Normalization for Gecko 1.9.1 (Firefox 3.5) support:
_normalizeFile: function (index, file) {
if (file.name === undefined && file.size === undefined) {
file.name = file.fileName;
file.size = file.fileSize;
}
},

_replaceFileInput: function (input) {
var inputClone = input.clone(true);
$('<form></form>').append(inputClone)[0].reset();
Expand All @@ -785,7 +777,7 @@

_getFileInputFiles: function (fileInput) {
fileInput = $(fileInput);
var files = $.each($.makeArray(fileInput.prop('files')), this._normalizeFile),
var files = $.makeArray(fileInput.prop('files')),
value;
if (!files.length) {
value = fileInput.prop('value');
Expand Down Expand Up @@ -837,10 +829,7 @@
var that = e.data.fileupload,
dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
data = {
files: $.each(
$.makeArray(dataTransfer && dataTransfer.files),
that._normalizeFile
)
files: $.makeArray(dataTransfer && dataTransfer.files)
};
if (that._trigger('drop', e, data) === false ||
that._onAdd(e, data) === false) {
Expand Down Expand Up @@ -946,7 +935,7 @@
if (data.fileInput && !data.files) {
data.files = this._getFileInputFiles(data.fileInput);
} else {
data.files = $.each($.makeArray(data.files), this._normalizeFile);
data.files = $.makeArray(data.files);
}
this._onAdd(null, data);
},
Expand All @@ -961,7 +950,7 @@
if (data.fileInput && !data.files) {
data.files = this._getFileInputFiles(data.fileInput);
} else {
data.files = $.each($.makeArray(data.files), this._normalizeFile);
data.files = $.makeArray(data.files);
}
if (data.files.length) {
return this._onSend(null, data);
Expand Down
19 changes: 4 additions & 15 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin Test 6.9.2
* jQuery File Upload Plugin Test 6.9.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -263,9 +263,8 @@ $(function () {
});

asyncTest('add', function () {
expect(4);
var param = {files: [{name: 'test'}]},
param2 = {files: [{fileName: 'test', fileSize: 123}]};
expect(2);
var param = {files: [{name: 'test'}]};
$('#fileupload').fileupload({
add: function (e, data) {
strictEqual(
Expand All @@ -278,22 +277,12 @@ $(function () {
'option',
'add',
function (e, data) {
strictEqual(
data.files[0].name,
param2.files[0].fileName,
'Normalizes fileName'
);
strictEqual(
data.files[0].size,
param2.files[0].fileSize,
'Normalizes fileSize'
);
data.submit().complete(function () {
ok(true, 'data.submit() Returns a jqXHR object');
start();
});
}
).fileupload('add', param2);
).fileupload('add', param);
});

asyncTest('send', function () {
Expand Down

0 comments on commit 788a49d

Please sign in to comment.