|
153 | 153 | // Remove the HTML5 form attribute from the input(s):
|
154 | 154 | options.fileInput.removeAttr('form');
|
155 | 155 | }
|
156 |
| - form.submit(); |
157 |
| - // Insert the file input fields at their original location |
158 |
| - // by replacing the clones with the originals: |
159 |
| - if (fileInputClones && fileInputClones.length) { |
160 |
| - options.fileInput.each(function (index, input) { |
161 |
| - var clone = $(fileInputClones[index]); |
162 |
| - // Restore the original name and form properties: |
163 |
| - $(input) |
164 |
| - .prop('name', clone.prop('name')) |
165 |
| - .attr('form', clone.attr('form')); |
166 |
| - clone.replaceWith(input); |
167 |
| - }); |
168 |
| - } |
| 156 | + window.setTimeout(function () { |
| 157 | + // Submitting the form in a setTimeout call fixes an issue with |
| 158 | + // Safari 13 not triggering the iframe load event after resetting |
| 159 | + // the load event handler, see also: |
| 160 | + // https://github.com/blueimp/jQuery-File-Upload/issues/3633 |
| 161 | + form.submit(); |
| 162 | + // Insert the file input fields at their original location |
| 163 | + // by replacing the clones with the originals: |
| 164 | + if (fileInputClones && fileInputClones.length) { |
| 165 | + options.fileInput.each(function (index, input) { |
| 166 | + var clone = $(fileInputClones[index]); |
| 167 | + // Restore the original name and form properties: |
| 168 | + $(input) |
| 169 | + .prop('name', clone.prop('name')) |
| 170 | + .attr('form', clone.attr('form')); |
| 171 | + clone.replaceWith(input); |
| 172 | + }); |
| 173 | + } |
| 174 | + }, 0); |
169 | 175 | });
|
170 | 176 | form.append(iframe).appendTo(document.body);
|
171 | 177 | },
|
|
0 commit comments