Skip to content

Commit

Permalink
Restore selected files in original form after successful iframe submit
Browse files Browse the repository at this point in the history
  • Loading branch information
s2b committed Oct 24, 2013
1 parent e85469d commit aaedfed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jquery.iframe-transport.js
Expand Up @@ -116,7 +116,10 @@
// and should revert all changes made to the page to enable the
// submission via this transport.
function cleanUp() {
markers.prop("disabled", false);
files.each(function (i, file) {
var $file = $(file);
$file.data("clone").replaceWith($file);
});
form.remove();
iframe.one("load", function() { iframe.remove(); });
iframe.attr("src", "javascript:false;");
Expand Down Expand Up @@ -175,7 +178,10 @@
// clones. This should also avoid introducing unwanted changes to the
// page layout during submission.
markers = files.after(function(idx) {
return $(this).clone().prop("disabled", true);
var $this = $(this),
$clone = $this.clone().prop("disabled", true);
$this.data("clone", $clone);
return $clone;
}).next();
files.appendTo(form);

Expand Down

0 comments on commit aaedfed

Please sign in to comment.