Skip to content

Commit

Permalink
Provide a reference to the cloned file input.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Jul 15, 2014
1 parent 41a3cdc commit 26563ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion blueimp-file-upload.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
"version": "9.5.8",
"version": "9.6.0",
"title": "jQuery File Upload",
"author": {
"name": "Sebastian Tschan",
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
"version": "9.5.8",
"version": "9.6.0",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [
Expand Down
13 changes: 7 additions & 6 deletions js/jquery.fileupload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin 5.40.3
* jQuery File Upload Plugin 5.41.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -1015,16 +1015,17 @@
return result;
},

_replaceFileInput: function (input, data) {
var inputClone = input.clone(true);
_replaceFileInput: function (data) {
var input = data.fileInput,
inputClone = input.clone(true);
// Add a reference for the new cloned file input to the data argument:
data.fileInputClone = inputClone;
$('<form></form>').append(inputClone)[0].reset();
// Detaching allows to insert the fileInput on another form
// without loosing the file input value:
input.after(inputClone).detach();
// Avoid memory leaks with the detached file input:
$.cleanData(input.unbind('remove'));
// Add a reference to the new cloned file input element
data.replacedFileInput=inputClone;
// Replace the original file input element in the fileInput
// elements set with the clone, which has been copied including
// event handlers:
Expand Down Expand Up @@ -1189,7 +1190,7 @@
this._getFileInputFiles(data.fileInput).always(function (files) {
data.files = files;
if (that.options.replaceFileInput) {
that._replaceFileInput(data.fileInput, data);
that._replaceFileInput(data);
}
if (that._trigger(
'change',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
"version": "9.5.8",
"version": "9.6.0",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&amp;drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [
Expand Down

0 comments on commit 26563ac

Please sign in to comment.