(a)
| 342 | |
| 343 | // private function for handling file uploads (hat tip to YAHOO!) |
| 344 | function fileUploadIframe(a) { |
| 345 | var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; |
| 346 | var deferred = $.Deferred(); |
| 347 | |
| 348 | // #341 |
| 349 | deferred.abort = function(status) { |
| 350 | xhr.abort(status); |
| 351 | }; |
| 352 | |
| 353 | if (a) { |
| 354 | // ensure that every serialized input is still enabled |
| 355 | for (i=0; i < elements.length; i++) { |
| 356 | el = $(elements[i]); |
| 357 | if ( hasProp ) { |
| 358 | el.prop('disabled', false); |
| 359 | } |
| 360 | else { |
| 361 | el.removeAttr('disabled'); |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | s = $.extend(true, {}, $.ajaxSettings, options); |
| 367 | s.context = s.context || s; |
| 368 | id = 'jqFormIO' + (new Date().getTime()); |
| 369 | if (s.iframeTarget) { |
| 370 | $io = $(s.iframeTarget); |
| 371 | n = $io.attr2('name'); |
| 372 | if (!n) { |
| 373 | $io.attr2('name', id); |
| 374 | } |
| 375 | else { |
| 376 | id = n; |
| 377 | } |
| 378 | } |
| 379 | else { |
| 380 | $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); |
| 381 | $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); |
| 382 | } |
| 383 | io = $io[0]; |
| 384 | |
| 385 | |
| 386 | xhr = { // mock object |
| 387 | aborted: 0, |
| 388 | responseText: null, |
| 389 | responseXML: null, |
| 390 | status: 0, |
| 391 | statusText: 'n/a', |
| 392 | getAllResponseHeaders: function() {}, |
| 393 | getResponseHeader: function() {}, |
| 394 | setRequestHeader: function() {}, |
| 395 | abort: function(status) { |
| 396 | var e = (status === 'timeout' ? 'timeout' : 'aborted'); |
| 397 | log('aborting upload... ' + e); |
| 398 | this.aborted = 1; |
| 399 | |
| 400 | try { // #214, #257 |
| 401 | if (io.contentWindow.document.execCommand) { |
no test coverage detected