From 6bd919cf91001e2077d847e4bdf67b7aa045a57d Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 21 May 2011 02:51:34 +0000 Subject: [PATCH] bump jquery.form to 2.75 --- web/javascript/jquery/jquery.form.js | 142 ++++++++++++++++++--------- 1 file changed, 93 insertions(+), 49 deletions(-) diff --git a/web/javascript/jquery/jquery.form.js b/web/javascript/jquery/jquery.form.js index 2f165464d..0801fa5f7 100644 --- a/web/javascript/jquery/jquery.form.js +++ b/web/javascript/jquery/jquery.form.js @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 2.47 (04-SEP-2010) + * version: 2.75 (20-MAY-2011) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ @@ -18,11 +18,11 @@ to bind your own submit handler to the form. For example, $(document).ready(function() { - $('#myForm').bind('submit', function() { + $('#myForm').bind('submit', function(e) { + e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); - return false; // <-- important! }); }); @@ -54,16 +54,18 @@ $.fn.ajaxSubmit = function(options) { options = { success: options }; } - var url = $.trim(this.attr('action')); + var action = this.attr('action'); + var url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } - url = url || window.location.href || ''; options = $.extend(true, { url: url, - type: this.attr('method') || 'GET', + success: $.ajaxSettings.success, + type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57) iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); @@ -167,7 +169,7 @@ $.fn.ajaxSubmit = function(options) { } } else { - $.ajax(options); + $.ajax(options); } // fire 'notify' event @@ -189,15 +191,7 @@ $.fn.ajaxSubmit = function(options) { var s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; - window[fn] = function() { - var f = $io.data('form-plugin-onload'); - if (f) { - f(); - window[fn] = undefined; - try { delete window[fn]; } catch(e){} - } - } - var $io = $('