Skip to content

Commit

Permalink
iframe load fix (mostly for Opera)
Browse files Browse the repository at this point in the history
  • Loading branch information
malsup committed Feb 20, 2010
1 parent bebf9b0 commit ab23940
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jquery.form.js
@@ -1,6 +1,6 @@
/*
* jQuery Form Plugin
* version: 2.38 (13-FEB-2010)
* version: 2.39 (19-FEB-2010)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
Expand Down Expand Up @@ -177,7 +177,7 @@ $.fn.ajaxSubmit = function(options) {
var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

var id = 'jqFormIO' + (new Date().getTime());
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" />');
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');
var io = $io[0];

$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
Expand Down Expand Up @@ -261,7 +261,7 @@ $.fn.ajaxSubmit = function(options) {

// add iframe to doc and submit the form
$io.appendTo('body');
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
$io.data('form-plugin-onload', cb);
form.submit();
}
finally {
Expand All @@ -282,7 +282,7 @@ $.fn.ajaxSubmit = function(options) {
function cb() {
if (cbInvoked++) return;

io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
$io.removeData('form-plugin-onload');

var ok = true;
try {
Expand Down

0 comments on commit ab23940

Please sign in to comment.