Skip to content

Commit

Permalink
fix ajaxupload.js
Browse files Browse the repository at this point in the history
• don't create overlay file input element if it already exists (can happen when upload component is within an update container)
• make overlay same height as button below it
• fix Safari javascript error
  • Loading branch information
darkv authored and Pascal Robert committed Apr 30, 2012
1 parent b866194 commit 280d46c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Frameworks/Ajax/Ajax/WebServerResources/ajaxupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@
* that will hover above the button
* <div><input type='file' /></div>
*/
_createInput: function(){
_createInput: function(){
// check if element already exists
var oldInput = document.getElementById(this._settings.name);
if (oldInput) {
this._input = oldInput;
return;
}
var self = this;
var input = document.createElement("input");
input.setAttribute('type', 'file');
Expand All @@ -370,7 +376,8 @@
'margin' : 0,
'padding' : 0,
'fontSize' : '480px',
'cursor' : 'pointer'
'cursor' : 'pointer',
'height' : '100%' // make overlay same height as button
});

var div = document.createElement("div");
Expand Down Expand Up @@ -428,7 +435,7 @@
// We use visibility instead of display to fix problem with Safari 4
// The problem is that the value of input doesn't change if it
// has display none when user selects a file
input.parentNode.style.visibility = 'hidden';
self._input.parentNode.style.visibility = 'hidden';

});

Expand Down

0 comments on commit 280d46c

Please sign in to comment.