cmlenz/jquery-iframe-transport

[patch] XHTML compatibility

Closed this issue · 1 comments

kvdb commented

Using the plugin with XHTML5 resulted in firefox not parsing the page correctly. Fix below.

--- static/js/jquery.iframe-transport.js    (revision 4818)
+++ static/js/jquery.iframe-transport.js    (working copy)
@@ -142,14 +142,14 @@
           name = value.name;
           value = value.value;
         }
-        $("<input type='hidden'>").attr({name:  name, value: value}).
+        $("<input type='hidden'></input>").attr({name:  name, value: value}).
           appendTo(form);
       });

       // Add a hidden `X-Requested-With` field with the value `IFrame` to the
       // field, to help server-side code to determine that the upload happened
       // through this transport.
-      $("<input type='hidden' value='IFrame' name='X-Requested-With'>").
+      $("<input type='hidden' value='IFrame' name='X-Requested-With'></input>").
         appendTo(form);

       // Move the file fields into the hidden form, but first remember their
kvdb commented

Also, to prevent opening a new tab to show output of the POST as described in
http://stackoverflow.com/questions/7083325/firefox-form-targetting-an-iframe-is-opening-new-tab

--- static/js/jquery.iframe-transport.js    (revision 4874)
+++ static/js/jquery.iframe-transport.js    (working copy)
@@ -167,7 +167,7 @@
         // sent.
         send: function(headers, completeCallback) {
           iframe = $("<iframe src='javascript:false;' name='" + name +
-            "' style='display:none'></iframe>");
+            "' id='" + name + "' style='display:none'></iframe>");

           // The first load event gets fired after the iframe has been injected
           // into the DOM, and is used to prepare the actual submission.