<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[17944] trunk/wp-includes: Update jQuery Form plugin, props duck_, fixes #15909</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17944">17944</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2011-05-17 14:22:50 +0000 (Tue, 17 May 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update jQuery Form plugin, props duck_, fixes <a href="http://trac.wordpress.org/ticket/15909">#15909</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsjqueryjqueryformdevjs">trunk/wp-includes/js/jquery/jquery.form.dev.js</a></li>
<li><a href="#trunkwpincludesjsjqueryjqueryformjs">trunk/wp-includes/js/jquery/jquery.form.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjsjqueryjqueryformdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/jquery/jquery.form.dev.js (17943 => 17944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/jquery/jquery.form.dev.js        2011-05-17 06:19:00 UTC (rev 17943)
+++ trunk/wp-includes/js/jquery/jquery.form.dev.js        2011-05-17 14:22:50 UTC (rev 17944)
</span><span class="lines">@@ -1,382 +1,470 @@
</span><del>-/*
</del><ins>+/*!
</ins><span class="cx">  * jQuery Form Plugin
</span><del>- * version: 2.02 (12/16/2007)
- * @requires jQuery v1.1 or later
</del><ins>+ * version: 2.73 (03-MAY-2011)
+ * @requires jQuery v1.3.2 or later
</ins><span class="cx">  *
</span><del>- * Examples at: http://malsup.com/jquery/form/
</del><ins>+ * Examples and documentation at: http://malsup.com/jquery/form/
</ins><span class="cx">  * Dual licensed under the MIT and GPL licenses:
</span><span class="cx">  *   http://www.opensource.org/licenses/mit-license.php
</span><span class="cx">  *   http://www.gnu.org/licenses/gpl.html
</span><del>- *
- * Revision: $Id$
</del><span class="cx">  */
</span><del>- (function($) {
</del><ins>+;(function($) {
+
+/*
+        Usage Note:
+        -----------
+        Do not use both ajaxSubmit and ajaxForm on the same form.  These
+        functions are intended to be exclusive.  Use ajaxSubmit if you want
+        to bind your own submit handler to the form.  For example,
+
+        $(document).ready(function() {
+                $('#myForm').bind('submit', function(e) {
+                        e.preventDefault(); // &lt;-- important
+                        $(this).ajaxSubmit({
+                                target: '#output'
+                        });
+                });
+        });
+
+        Use ajaxForm when you want the plugin to manage all the event binding
+        for you.  For example,
+
+        $(document).ready(function() {
+                $('#myForm').ajaxForm({
+                        target: '#output'
+                });
+        });
+
+        When using ajaxForm, the ajaxSubmit function will be invoked for you
+        at the appropriate time.
+*/
+
</ins><span class="cx"> /**
</span><del>- * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
- *
- * ajaxSubmit accepts a single argument which can be either a success callback function
- * or an options Object.  If a function is provided it will be invoked upon successful
- * completion of the submit and will be passed the response from the server.
- * If an options Object is provided, the following attributes are supported:
- *
- *  target:   Identifies the element(s) in the page to be updated with the server response.
- *            This value may be specified as a jQuery selection string, a jQuery object,
- *            or a DOM element.
- *            default value: null
- *
- *  url:      URL to which the form data will be submitted.
- *            default value: value of form's 'action' attribute
- *
- *  type:     The method in which the form data should be submitted, 'GET' or 'POST'.
- *            default value: value of form's 'method' attribute (or 'GET' if none found)
- *
- *  data:     Additional data to add to the request, specified as key/value pairs (see $.ajax).
- *
- *  beforeSubmit:  Callback method to be invoked before the form is submitted.
- *            default value: null
- *
- *  success:  Callback method to be invoked after the form has been successfully submitted
- *            and the response has been returned from the server
- *            default value: null
- *
- *  dataType: Expected dataType of the response.  One of: null, 'xml', 'script', or 'json'
- *            default value: null
- *
- *  semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
- *            default value: false
- *
- *  resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
- *
- *  clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
- *
- *
- * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
- * validating the form data.  If the 'beforeSubmit' callback returns false then the form will
- * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
- * in array format, the jQuery object, and the options object passed into ajaxSubmit.
- * The form data array takes the following form:
- *
- *     [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * If a 'success' callback method is provided it is invoked after the response has been returned
- * from the server.  It is passed the responseText or responseXML value (depending on dataType).
- * See jQuery.ajax for further details.
- *
- *
- * The dataType option provides a means for specifying how the server response should be handled.
- * This maps directly to the jQuery.httpData method.  The following values are supported:
- *
- *      'xml':    if dataType == 'xml' the server response is treated as XML and the 'success'
- *                   callback method, if specified, will be passed the responseXML value
- *      'json':   if dataType == 'json' the server response will be evaluted and passed to
- *                   the 'success' callback, if specified
- *      'script': if dataType == 'script' the server response is evaluated in the global context
- *
- *
- * Note that it does not make sense to use both the 'target' and 'dataType' options.  If both
- * are provided the target will be ignored.
- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image&quot; then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- *
- * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
- *
- * $(&quot;#form-id&quot;).submit(function() {
- *     $(this).ajaxSubmit(options);
- *     return false; // cancel conventional submit
- * });
- *
- * When using ajaxForm(), however, this is done for you.
- *
- * @example
- * $('#myForm').ajaxSubmit(function(data) {
- *     alert('Form submit succeeded! Server returned: ' + data);
- * });
- * @desc Submit form and alert server response
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and update page element with server response
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Submit form and alert the server response
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Pre-submit validation which aborts the submit operation if form data is empty
- *
- *
- * @example
- * var options = {
- *     url: myJsonUrl.php,
- *     dataType: 'json',
- *     success: function(data) {
- *        // 'data' is an object representing the the evaluated json data
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc json data returned and evaluated
- *
- *
- * @example
- * var options = {
- *     url: myXmlUrl.php,
- *     dataType: 'xml',
- *     success: function(responseXML) {
- *        // responseXML is XML document object
- *        var data = $('myElement', responseXML).text();
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc XML data returned from server
- *
- *
- * @example
- * var options = {
- *     resetForm: true
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc submit form and reset it if successful
- *
- * @example
- * $('#myForm).submit(function() {
- *    $(this).ajaxSubmit();
- *    return false;
- * });
- * @desc Bind form's submit event to use ajaxSubmit
- *
- *
- * @name ajaxSubmit
- * @type jQuery
- * @param options  object literal containing options which control the form submission process
- * @cat Plugins/Form
- * @return jQuery
</del><ins>+ * ajaxSubmit() provides a mechanism for immediately submitting
+ * an HTML form using AJAX.
</ins><span class="cx">  */
</span><span class="cx"> $.fn.ajaxSubmit = function(options) {
</span><del>-    if (typeof options == 'function')
-        options = { success: options };
</del><ins>+        // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+        if (!this.length) {
+                log('ajaxSubmit: skipping submit process - no element selected');
+                return this;
+        }
</ins><span class="cx"> 
</span><del>-    options = $.extend({
-        url:  this.attr('action') || window.location.toString(),
-        type: this.attr('method') || 'GET'
-    }, options || {});
</del><ins>+        if (typeof options == 'function') {
+                options = { success: options };
+        }
</ins><span class="cx"> 
</span><del>-    // hook for manipulating the form data before it is extracted;
-    // convenient for use with rich editors like tinyMCE or FCKEditor
-    var veto = {};
-    $.event.trigger('form.pre.serialize', [this, options, veto]);
-    if (veto.veto) return this;
</del><ins>+        var action = this.attr('action');
+        var url = (typeof action === 'string') ? $.trim(action) : '';
+        if (url) {
+                // clean url (don't include hash vaue)
+                url = (url.match(/^([^#]+)/)||[])[1];
+        }
+        url = url || window.location.href || '';
</ins><span class="cx"> 
</span><del>-    var a = this.formToArray(options.semantic);
</del><ins>+        options = $.extend(true, {
+                url:  url,
+                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);
+
+        // hook for manipulating the form data before it is extracted;
+        // convenient for use with rich editors like tinyMCE or FCKEditor
+        var veto = {};
+        this.trigger('form-pre-serialize', [this, options, veto]);
+        if (veto.veto) {
+                log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
+                return this;
+        }
+
+        // provide opportunity to alter form data before it is serialized
+        if (options.beforeSerialize &amp;&amp; options.beforeSerialize(this, options) === false) {
+                log('ajaxSubmit: submit aborted via beforeSerialize callback');
+                return this;
+        }
+
+        var n,v,a = this.formToArray(options.semantic);
</ins><span class="cx">         if (options.data) {
</span><del>-            for (var n in options.data)
-                a.push( { name: n, value: options.data[n] } );
</del><ins>+                options.extraData = options.data;
+                for (n in options.data) {
+                        if(options.data[n] instanceof Array) {
+                                for (var k in options.data[n]) {
+                                        a.push( { name: n, value: options.data[n][k] } );
+                                }
+                        }
+                        else {
+                                v = options.data[n];
+                                v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
+                                a.push( { name: n, value: v } );
+                        }
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-    // give pre-submit callback an opportunity to abort the submit
-    if (options.beforeSubmit &amp;&amp; options.beforeSubmit(a, this, options) === false) return this;
</del><ins>+        // give pre-submit callback an opportunity to abort the submit
+        if (options.beforeSubmit &amp;&amp; options.beforeSubmit(a, this, options) === false) {
+                log('ajaxSubmit: submit aborted via beforeSubmit callback');
+                return this;
+        }
</ins><span class="cx"> 
</span><del>-    // fire vetoable 'validate' event
-    $.event.trigger('form.submit.validate', [a, this, options, veto]);
-    if (veto.veto) return this;
</del><ins>+        // fire vetoable 'validate' event
+        this.trigger('form-submit-validate', [a, this, options, veto]);
+        if (veto.veto) {
+                log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
+                return this;
+        }
</ins><span class="cx"> 
</span><del>-    var q = $.param(a);//.replace(/%20/g,'+');
</del><ins>+        var q = $.param(a);
</ins><span class="cx"> 
</span><del>-    if (options.type.toUpperCase() == 'GET') {
-        options.url += (options.url.indexOf('?') &gt;= 0 ? '&amp;' : '?') + q;
-        options.data = null;  // data is null for 'get'
-    }
-    else
-        options.data = q; // data is the query string for 'post'
</del><ins>+        if (options.type.toUpperCase() == 'GET') {
+                options.url += (options.url.indexOf('?') &gt;= 0 ? '&amp;' : '?') + q;
+                options.data = null;  // data is null for 'get'
+        }
+        else {
+                options.data = q; // data is the query string for 'post'
+        }
</ins><span class="cx"> 
</span><del>-    var $form = this, callbacks = [];
-    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
-    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
</del><ins>+        var $form = this, callbacks = [];
+        if (options.resetForm) {
+                callbacks.push(function() { $form.resetForm(); });
+        }
+        if (options.clearForm) {
+                callbacks.push(function() { $form.clearForm(); });
+        }
</ins><span class="cx"> 
</span><del>-    // perform a load on the target only if dataType is not provided
-    if (!options.dataType &amp;&amp; options.target) {
-        var oldSuccess = options.success || function(){};
-        callbacks.push(function(data) {
-            if (this.evalScripts)
-                $(options.target).attr(&quot;innerHTML&quot;, data).evalScripts().each(oldSuccess, arguments);
-            else // jQuery v1.1.4
-                $(options.target).html(data).each(oldSuccess, arguments);
-        });
-    }
-    else if (options.success)
-        callbacks.push(options.success);
</del><ins>+        // perform a load on the target only if dataType is not provided
+        if (!options.dataType &amp;&amp; options.target) {
+                var oldSuccess = options.success || function(){};
+                callbacks.push(function(data) {
+                        var fn = options.replaceTarget ? 'replaceWith' : 'html';
+                        $(options.target)[fn](data).each(oldSuccess, arguments);
+                });
+        }
+        else if (options.success) {
+                callbacks.push(options.success);
+        }
</ins><span class="cx"> 
</span><del>-    options.success = function(data, status) {
-        for (var i=0, max=callbacks.length; i &lt; max; i++)
-            callbacks[i](data, status, $form);
-    };
</del><ins>+        options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
+                var context = options.context || options;   // jQuery 1.4+ supports scope context
+                for (var i=0, max=callbacks.length; i &lt; max; i++) {
+                        callbacks[i].apply(context, [data, status, xhr || $form, $form]);
+                }
+        };
</ins><span class="cx"> 
</span><del>-    // are there files to upload?
-    var files = $('input:file', this).fieldValue();
-    var found = false;
-    for (var j=0; j &lt; files.length; j++)
-        if (files[j])
-            found = true;
</del><ins>+        // are there files to upload?
+        var fileInputs = $('input:file', this).length &gt; 0;
+        var mp = 'multipart/form-data';
+        var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
</ins><span class="cx"> 
</span><del>-    // options.iframe allows user to force iframe mode
-   if (options.iframe || found) { 
-       // hack to fix Safari hang (thanks to Tim Molendijk for this)
-       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
-       if ($.browser.safari &amp;&amp; options.closeKeepAlive)
-           $.get(options.closeKeepAlive, fileUpload);
-       else
-           fileUpload();
-       }
-   else
-       $.ajax(options);
</del><ins>+        // options.iframe allows user to force iframe mode
+        // 06-NOV-09: now defaulting to iframe mode if file input is detected
+   if (options.iframe !== false &amp;&amp; (fileInputs || options.iframe || multipart)) {
+           // hack to fix Safari hang (thanks to Tim Molendijk for this)
+           // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
+           if (options.closeKeepAlive) {
+                   $.get(options.closeKeepAlive, fileUpload);
+                }
+           else {
+                   fileUpload();
+                }
+   }
+   else {
+                $.ajax(options);
+   }
</ins><span class="cx"> 
</span><del>-    // fire 'notify' event
-    $.event.trigger('form.submit.notify', [this, options]);
-    return this;
</del><ins>+        // fire 'notify' event
+        this.trigger('form-submit-notify', [this, options]);
+        return this;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-    // private function for handling file uploads (hat tip to YAHOO!)
-    function fileUpload() {
-        var form = $form[0];
-        var opts = $.extend({}, $.ajaxSettings, options);
</del><ins>+        // private function for handling file uploads (hat tip to YAHOO!)
+        function fileUpload() {
+                var form = $form[0];
</ins><span class="cx"> 
</span><del>-        var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
-        var $io = $('&lt;iframe id=&quot;' + id + '&quot; name=&quot;' + id + '&quot; /&gt;');
-        var io = $io[0];
-        var op8 = $.browser.opera &amp;&amp; window.opera.version() &lt; 9;
-        if ($.browser.msie || op8) io.src = 'javascript:false;document.write(&quot;&quot;);';
-        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
</del><ins>+                if ($(':input[name=submit],:input[id=submit]', form).length) {
+                        // if there is an input with a name or id of 'submit' then we won't be
+                        // able to invoke the submit fn on the form (at least not x-browser)
+                        alert('Error: Form elements must not have name or id of &quot;submit&quot;.');
+                        return;
+                }
</ins><span class="cx"> 
</span><del>-        var xhr = { // mock object
-            responseText: null,
-            responseXML: null,
-            status: 0,
-            statusText: 'n/a',
-            getAllResponseHeaders: function() {},
-            getResponseHeader: function() {},
-            setRequestHeader: function() {}
-        };
</del><ins>+                var s = $.extend(true, {}, $.ajaxSettings, options);
+                s.context = s.context || s;
+                var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
+                var $io = $('&lt;iframe id=&quot;' + id + '&quot; name=&quot;' + id + '&quot; src=&quot;'+ s.iframeSrc +'&quot; /&gt;');
+                var io = $io[0];
</ins><span class="cx"> 
</span><del>-        var g = opts.global;
-        // trigger ajax global events so that activity/block indicators work like normal
-        if (g &amp;&amp; ! $.active++) $.event.trigger(&quot;ajaxStart&quot;);
-        if (g) $.event.trigger(&quot;ajaxSend&quot;, [xhr, opts]);
</del><ins>+                $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
</ins><span class="cx"> 
</span><del>-        var cbInvoked = 0;
-        var timedOut = 0;
</del><ins>+                var xhr = { // mock object
+                        aborted: 0,
+                        responseText: null,
+                        responseXML: null,
+                        status: 0,
+                        statusText: 'n/a',
+                        getAllResponseHeaders: function() {},
+                        getResponseHeader: function() {},
+                        setRequestHeader: function() {},
+                        abort: function(status) {
+                                var e = (status === 'timeout' ? 'timeout' : 'aborted');
+                                log('aborting upload... ' + e);
+                                this.aborted = 1;
+                                $io.attr('src', s.iframeSrc); // abort op in progress
+                                xhr.error = e;
+                                s.error &amp;&amp; s.error.call(s.context, xhr, e, e);
+                                g &amp;&amp; $.event.trigger(&quot;ajaxError&quot;, [xhr, s, e]);
+                                s.complete &amp;&amp; s.complete.call(s.context, xhr, e);
+                        }
+                };
</ins><span class="cx"> 
</span><del>-        // take a breath so that pending repaints get some cpu time before the upload starts
-        setTimeout(function() {
-            // make sure form attrs are set
-            var encAttr = form.encoding ? 'encoding' : 'enctype';
-            var t = $form.attr('target');
-            $form.attr({
-                target:   id,
-                method:  'POST',
-                action:   opts.url
-            });
-            form[encAttr] = 'multipart/form-data';
</del><ins>+                var g = s.global;
+                // trigger ajax global events so that activity/block indicators work like normal
+                if (g &amp;&amp; ! $.active++) {
+                        $.event.trigger(&quot;ajaxStart&quot;);
+                }
+                if (g) {
+                        $.event.trigger(&quot;ajaxSend&quot;, [xhr, s]);
+                }
</ins><span class="cx"> 
</span><del>-            // support timout
-            if (opts.timeout)
-                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
</del><ins>+                if (s.beforeSend &amp;&amp; s.beforeSend.call(s.context, xhr, s) === false) {
+                        if (s.global) {
+                                $.active--;
+                        }
+                        return;
+                }
+                if (xhr.aborted) {
+                        return;
+                }
</ins><span class="cx"> 
</span><del>-            // add iframe to doc and submit the form
-            $io.appendTo('body');
-            io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
-            form.submit();
-            $form.attr('target', t); // reset target
-        }, 10);
</del><ins>+                var timedOut = 0, timeoutHandle;
</ins><span class="cx"> 
</span><del>-        function cb() {
-            if (cbInvoked++) return;
</del><ins>+                // add submitting element to data if we know it
+                var sub = form.clk;
+                if (sub) {
+                        var n = sub.name;
+                        if (n &amp;&amp; !sub.disabled) {
+                                s.extraData = s.extraData || {};
+                                s.extraData[n] = sub.value;
+                                if (sub.type == &quot;image&quot;) {
+                                        s.extraData[n+'.x'] = form.clk_x;
+                                        s.extraData[n+'.y'] = form.clk_y;
+                                }
+                        }
+                }
</ins><span class="cx"> 
</span><ins>+                // take a breath so that pending repaints get some cpu time before the upload starts
+                function doSubmit() {
+                        // make sure form attrs are set
+                        var t = $form.attr('target'), a = $form.attr('action');
+
+                        // update form attrs in IE friendly way
+                        form.setAttribute('target',id);
+                        if (form.getAttribute('method') != 'POST') {
+                                form.setAttribute('method', 'POST');
+                        }
+                        if (form.getAttribute('action') != s.url) {
+                                form.setAttribute('action', s.url);
+                        }
+
+                        // ie borks in some cases when setting encoding
+                        if (! s.skipEncodingOverride) {
+                                $form.attr({
+                                        encoding: 'multipart/form-data',
+                                        enctype:  'multipart/form-data'
+                                });
+                        }
+
+                        // support timout
+                        if (s.timeout) {
+                                timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
+                        }
+
+                        // add &quot;extra&quot; data to form if provided in options
+                        var extraInputs = [];
+                        try {
+                                if (s.extraData) {
+                                        for (var n in s.extraData) {
+                                                extraInputs.push(
+                                                        $('&lt;input type=&quot;hidden&quot; name=&quot;'+n+'&quot; value=&quot;'+s.extraData[n]+'&quot; /&gt;')
+                                                                .appendTo(form)[0]);
+                                        }
+                                }
+
+                                // add iframe to doc and submit the form
+                                $io.appendTo('body');
+                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+                                form.submit();
+                        }
+                        finally {
+                                // reset attrs and remove &quot;extra&quot; input elements
+                                form.setAttribute('action',a);
+                                if(t) {
+                                        form.setAttribute('target', t);
+                                } else {
+                                        $form.removeAttr('target');
+                                }
+                                $(extraInputs).remove();
+                        }
+                }
+
+                if (s.forceSync) {
+                        doSubmit();
+                }
+                else {
+                        setTimeout(doSubmit, 10); // this lets dom updates render
+                }
+
+                var data, doc, domCheckCount = 50, callbackProcessed;
+
+                function cb(e) {
+                        if (xhr.aborted || callbackProcessed) {
+                                return;
+                        }
+                        if (e === true &amp;&amp; xhr) {
+                                xhr.abort('timeout');
+                                return;
+                        }
+
+                        var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
+                        if (!doc || doc.location.href == s.iframeSrc) {
+                                // response not received yet
+                                if (!timedOut)
+                                        return;
+                        }
</ins><span class="cx">             io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
</span><span class="cx"> 
</span><del>-            var ok = true;
-            try {
-                if (timedOut) throw 'timeout';
-                // extract the server response from the iframe
-                var data, doc;
-                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
-                xhr.responseText = doc.body ? doc.body.innerHTML : null;
-                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
</del><ins>+                        var ok = true;
+                        try {
+                                if (timedOut) {
+                                        throw 'timeout';
+                                }
</ins><span class="cx"> 
</span><del>-                if (opts.dataType == 'json' || opts.dataType == 'script') {
-                    var ta = doc.getElementsByTagName('textarea')[0];
-                    data = ta ? ta.value : xhr.responseText;
-                    if (opts.dataType == 'json')
-                        eval(&quot;data = &quot; + data);
-                    else
-                        $.globalEval(data);
-                }
-                else if (opts.dataType == 'xml') {
-                    data = xhr.responseXML;
-                    if (!data &amp;&amp; xhr.responseText != null)
-                        data = toXml(xhr.responseText);
-                }
-                else {
-                    data = xhr.responseText;
-                }
-            }
-            catch(e){
-                ok = false;
-                $.handleError(opts, xhr, 'error', e);
-            }
</del><ins>+                                var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
+                                log('isXml='+isXml);
+                                if (!isXml &amp;&amp; window.opera &amp;&amp; (doc.body == null || doc.body.innerHTML == '')) {
+                                        if (--domCheckCount) {
+                                                // in some browsers (Opera) the iframe DOM is not always traversable when
+                                                // the onload callback fires, so we loop a bit to accommodate
+                                                log('requeing onLoad callback, DOM not available');
+                                                setTimeout(cb, 250);
+                                                return;
+                                        }
+                                        // let this fall through because server response could be an empty document
+                                        //log('Could not access iframe DOM after mutiple tries.');
+                                        //throw 'DOMException: not available';
+                                }
</ins><span class="cx"> 
</span><del>-            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
-            if (ok) {
-                opts.success(data, 'success');
-                if (g) $.event.trigger(&quot;ajaxSuccess&quot;, [xhr, opts]);
-            }
-            if (g) $.event.trigger(&quot;ajaxComplete&quot;, [xhr, opts]);
-            if (g &amp;&amp; ! --$.active) $.event.trigger(&quot;ajaxStop&quot;);
-            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
</del><ins>+                                //log('response detected');
+                                xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
+                                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+                                if (isXml)
+                                        s.dataType = 'xml';
+                                xhr.getResponseHeader = function(header){
+                                        var headers = {'content-type': s.dataType};
+                                        return headers[header];
+                                };
</ins><span class="cx"> 
</span><del>-            // clean up
-            setTimeout(function() {
-                $io.remove();
-                xhr.responseXML = null;
-            }, 100);
-        };
</del><ins>+                                var scr = /(json|script|text)/.test(s.dataType);
+                                if (scr || s.textarea) {
+                                        // see if user embedded response in textarea
+                                        var ta = doc.getElementsByTagName('textarea')[0];
+                                        if (ta) {
+                                                xhr.responseText = ta.value;
+                                        }
+                                        else if (scr) {
+                                                // account for browsers injecting pre around json response
+                                                var pre = doc.getElementsByTagName('pre')[0];
+                                                var b = doc.getElementsByTagName('body')[0];
+                                                if (pre) {
+                                                        xhr.responseText = pre.textContent;
+                                                }
+                                                else if (b) {
+                                                        xhr.responseText = b.innerHTML;
+                                                }
+                                        }
+                                }
+                                else if (s.dataType == 'xml' &amp;&amp; !xhr.responseXML &amp;&amp; xhr.responseText != null) {
+                                        xhr.responseXML = toXml(xhr.responseText);
+                                }
</ins><span class="cx"> 
</span><del>-        function toXml(s, doc) {
-            if (window.ActiveXObject) {
-                doc = new ActiveXObject('Microsoft.XMLDOM');
-                doc.async = 'false';
-                doc.loadXML(s);
-            }
-            else
-                doc = (new DOMParser()).parseFromString(s, 'text/xml');
-            return (doc &amp;&amp; doc.documentElement &amp;&amp; doc.documentElement.tagName != 'parsererror') ? doc : null;
-        };
-    };
</del><ins>+                                data = httpData(xhr, s.dataType, s);
+                        }
+                        catch(e){
+                                log('error caught:',e);
+                                ok = false;
+                                xhr.error = e;
+                                s.error &amp;&amp; s.error.call(s.context, xhr, 'error', e);
+                                g &amp;&amp; $.event.trigger(&quot;ajaxError&quot;, [xhr, s, e]);
+                        }
+
+                        if (xhr.aborted) {
+                                log('upload aborted');
+                                ok = false;
+                        }
+
+                        // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+                        if (ok) {
+                                s.success &amp;&amp; s.success.call(s.context, data, 'success', xhr);
+                                g &amp;&amp; $.event.trigger(&quot;ajaxSuccess&quot;, [xhr, s]);
+                        }
+
+                        g &amp;&amp; $.event.trigger(&quot;ajaxComplete&quot;, [xhr, s]);
+
+                        if (g &amp;&amp; ! --$.active) {
+                                $.event.trigger(&quot;ajaxStop&quot;);
+                        }
+
+                        s.complete &amp;&amp; s.complete.call(s.context, xhr, ok ? 'success' : 'error');
+
+                        callbackProcessed = true;
+                        if (s.timeout)
+                                clearTimeout(timeoutHandle);
+
+                        // clean up
+                        setTimeout(function() {
+                                $io.removeData('form-plugin-onload');
+                                $io.remove();
+                                xhr.responseXML = null;
+                        }, 100);
+                }
+
+                var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
+                        if (window.ActiveXObject) {
+                                doc = new ActiveXObject('Microsoft.XMLDOM');
+                                doc.async = 'false';
+                                doc.loadXML(s);
+                        }
+                        else {
+                                doc = (new DOMParser()).parseFromString(s, 'text/xml');
+                        }
+                        return (doc &amp;&amp; doc.documentElement &amp;&amp; doc.documentElement.nodeName != 'parsererror') ? doc : null;
+                };
+                var parseJSON = $.parseJSON || function(s) {
+                        return window['eval']('(' + s + ')');
+                };
+
+                var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
+                        var ct = xhr.getResponseHeader('content-type') || '',
+                                xml = type === 'xml' || !type &amp;&amp; ct.indexOf('xml') &gt;= 0,
+                                data = xml ? xhr.responseXML : xhr.responseText;
+
+                        if (xml &amp;&amp; data.documentElement.nodeName === 'parsererror') {
+                                $.error &amp;&amp; $.error('parsererror');
+                        }
+                        if (s &amp;&amp; s.dataFilter) {
+                                data = s.dataFilter(data, type);
+                        }
+                        if (typeof data === 'string') {
+                                if (type === 'json' || !type &amp;&amp; ct.indexOf('json') &gt;= 0) {
+                                        data = parseJSON(data);
+                                } else if (type === &quot;script&quot; || !type &amp;&amp; ct.indexOf(&quot;javascript&quot;) &gt;= 0) {
+                                        $.globalEval(data);
+                                }
+                        }
+                        return data;
+                };
+        }
</ins><span class="cx"> };
</span><del>-$.fn.ajaxSubmit.counter = 0; // used to create unique iframe ids
</del><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * ajaxForm() provides a mechanism for fully automating form submission.
</span><span class="lines">@@ -384,112 +472,70 @@
</span><span class="cx">  * The advantages of using this method instead of ajaxSubmit() are:
</span><span class="cx">  *
</span><span class="cx">  * 1: This method will include coordinates for &lt;input type=&quot;image&quot; /&gt; elements (if the element
</span><del>- *    is used to submit the form).
</del><ins>+ *        is used to submit the form).
</ins><span class="cx">  * 2. This method will include the submit element's name/value data (for the element that was
</span><del>- *    used to submit the form).
</del><ins>+ *        used to submit the form).
</ins><span class="cx">  * 3. This method binds the submit() method to the form for you.
</span><span class="cx">  *
</span><del>- * Note that for accurate x/y coordinates of image submit elements in all browsers
- * you need to also use the &quot;dimensions&quot; plugin (this method will auto-detect its presence).
- *
</del><span class="cx">  * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
</span><span class="cx">  * passes the options argument along after properly binding events for submit elements and
</span><del>- * the form itself.  See ajaxSubmit for a full description of the options argument.
- *
- *
- * @example
- * var options = {
- *     target: '#myTargetDiv'
- * };
- * $('#myForm').ajaxSForm(options);
- * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
- *       when the form is submitted.
- *
- *
- * @example
- * var options = {
- *     success: function(responseText) {
- *         alert(responseText);
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that server response is alerted after the form is submitted.
- *
- *
- * @example
- * var options = {
- *     beforeSubmit: function(formArray, jqForm) {
- *         if (formArray.length == 0) {
- *             alert('Please enter data.');
- *             return false;
- *         }
- *     }
- * };
- * $('#myForm').ajaxSubmit(options);
- * @desc Bind form's submit event so that pre-submit callback is invoked before the form
- *       is submitted.
- *
- *
- * @name   ajaxForm
- * @param  options  object literal containing options which control the form submission process
- * @return jQuery
- * @cat    Plugins/Form
- * @type   jQuery
</del><ins>+ * the form itself.
</ins><span class="cx">  */
</span><span class="cx"> $.fn.ajaxForm = function(options) {
</span><del>-    return this.ajaxFormUnbind().submit(submitHandler).each(function() {
-        // store options in hash
-        this.formPluginId = $.fn.ajaxForm.counter++;
-        $.fn.ajaxForm.optionHash[this.formPluginId] = options;
-        $(&quot;:submit,input:image&quot;, this).click(clickHandler);
-    });
-};
</del><ins>+        // in jQuery 1.3+ we can fix mistakes with the ready state
+        if (this.length === 0) {
+                var o = { s: this.selector, c: this.context };
+                if (!$.isReady &amp;&amp; o.s) {
+                        log('DOM not ready, queuing ajaxForm');
+                        $(function() {
+                                $(o.s,o.c).ajaxForm(options);
+                        });
+                        return this;
+                }
+                // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
+                log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
+                return this;
+        }
</ins><span class="cx"> 
</span><del>-$.fn.ajaxForm.counter = 1;
-$.fn.ajaxForm.optionHash = {};
-
-function clickHandler(e) {
-    var $form = this.form;
-    $form.clk = this;
-    if (this.type == 'image') {
-        if (e.offsetX != undefined) {
-            $form.clk_x = e.offsetX;
-            $form.clk_y = e.offsetY;
-        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
-            var offset = $(this).offset();
-            $form.clk_x = e.pageX - offset.left;
-            $form.clk_y = e.pageY - offset.top;
-        } else {
-            $form.clk_x = e.pageX - this.offsetLeft;
-            $form.clk_y = e.pageY - this.offsetTop;
-        }
-    }
-    // clear form vars
-    setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
</del><ins>+        return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
+                if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
+                        e.preventDefault();
+                        $(this).ajaxSubmit(options);
+                }
+        }).bind('click.form-plugin', function(e) {
+                var target = e.target;
+                var $el = $(target);
+                if (!($el.is(&quot;:submit,input:image&quot;))) {
+                        // is this a child element of the submit el?  (ex: a span within a button)
+                        var t = $el.closest(':submit');
+                        if (t.length == 0) {
+                                return;
+                        }
+                        target = t[0];
+                }
+                var form = this;
+                form.clk = target;
+                if (target.type == 'image') {
+                        if (e.offsetX != undefined) {
+                                form.clk_x = e.offsetX;
+                                form.clk_y = e.offsetY;
+                        } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
+                                var offset = $el.offset();
+                                form.clk_x = e.pageX - offset.left;
+                                form.clk_y = e.pageY - offset.top;
+                        } else {
+                                form.clk_x = e.pageX - target.offsetLeft;
+                                form.clk_y = e.pageY - target.offsetTop;
+                        }
+                }
+                // clear form vars
+                setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-function submitHandler() {
-    // retrieve options from hash
-    var id = this.formPluginId;
-    var options = $.fn.ajaxForm.optionHash[id];
-    $(this).ajaxSubmit(options);
-    return false;
-};
-
-/**
- * ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
- *
- * @name   ajaxFormUnbind
- * @return jQuery
- * @cat    Plugins/Form
- * @type   jQuery
- */
</del><ins>+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
</ins><span class="cx"> $.fn.ajaxFormUnbind = function() {
</span><del>-    this.unbind('submit', submitHandler);
-    return this.each(function() {
-        $(&quot;:submit,input:image&quot;, this).unbind('click', clickHandler);
-    });
-
</del><ins>+        return this.unbind('submit.form-plugin click.form-plugin');
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -502,144 +548,103 @@
</span><span class="cx">  *
</span><span class="cx">  * It is this array that is passed to pre-submit callback functions provided to the
</span><span class="cx">  * ajaxSubmit() and ajaxForm() methods.
</span><del>- *
- * The semantic argument can be used to force form serialization in semantic order.
- * This is normally true anyway, unless the form contains input elements of type='image'.
- * If your form must be submitted with name/value pairs in semantic order and your form
- * contains an input of type='image&quot; then pass true for this arg, otherwise pass false
- * (or nothing) to avoid the overhead for this logic.
- *
- * @example var data = $(&quot;#myForm&quot;).formToArray();
- * $.post( &quot;myscript.cgi&quot;, data );
- * @desc Collect all the data from a form and submit it to the server.
- *
- * @name formToArray
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type Array&lt;Object&gt;
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fn.formToArray = function(semantic) {
</span><del>-    var a = [];
-    if (this.length == 0) return a;
</del><ins>+        var a = [];
+        if (this.length === 0) {
+                return a;
+        }
</ins><span class="cx"> 
</span><del>-    var form = this[0];
-    var els = semantic ? form.getElementsByTagName('*') : form.elements;
-    if (!els) return a;
-    for(var i=0, max=els.length; i &lt; max; i++) {
-        var el = els[i];
-        var n = el.name;
-        if (!n) continue;
</del><ins>+        var form = this[0];
+        var els = semantic ? form.getElementsByTagName('*') : form.elements;
+        if (!els) {
+                return a;
+        }
</ins><span class="cx"> 
</span><del>-        if (semantic &amp;&amp; form.clk &amp;&amp; el.type == &quot;image&quot;) {
-            // handle image inputs on the fly when semantic == true
-            if(!el.disabled &amp;&amp; form.clk == el)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-            continue;
-        }
</del><ins>+        var i,j,n,v,el,max,jmax;
+        for(i=0, max=els.length; i &lt; max; i++) {
+                el = els[i];
+                n = el.name;
+                if (!n) {
+                        continue;
+                }
</ins><span class="cx"> 
</span><del>-        var v = $.fieldValue(el, true);
-        if (v &amp;&amp; v.constructor == Array) {
-            for(var j=0, jmax=v.length; j &lt; jmax; j++)
-                a.push({name: n, value: v[j]});
-        }
-        else if (v !== null &amp;&amp; typeof v != 'undefined')
-            a.push({name: n, value: v});
-    }
</del><ins>+                if (semantic &amp;&amp; form.clk &amp;&amp; el.type == &quot;image&quot;) {
+                        // handle image inputs on the fly when semantic == true
+                        if(!el.disabled &amp;&amp; form.clk == el) {
+                                a.push({name: n, value: $(el).val()});
+                                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+                        }
+                        continue;
+                }
</ins><span class="cx"> 
</span><del>-    if (!semantic &amp;&amp; form.clk) {
-        // input type=='image' are not found in elements array! handle them here
-        var inputs = form.getElementsByTagName(&quot;input&quot;);
-        for(var i=0, max=inputs.length; i &lt; max; i++) {
-            var input = inputs[i];
-            var n = input.name;
-            if(n &amp;&amp; !input.disabled &amp;&amp; input.type == &quot;image&quot; &amp;&amp; form.clk == input)
-                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
-        }
-    }
-    return a;
</del><ins>+                v = $.fieldValue(el, true);
+                if (v &amp;&amp; v.constructor == Array) {
+                        for(j=0, jmax=v.length; j &lt; jmax; j++) {
+                                a.push({name: n, value: v[j]});
+                        }
+                }
+                else if (v !== null &amp;&amp; typeof v != 'undefined') {
+                        a.push({name: n, value: v});
+                }
+        }
+
+        if (!semantic &amp;&amp; form.clk) {
+                // input type=='image' are not found in elements array! handle it here
+                var $input = $(form.clk), input = $input[0];
+                n = input.name;
+                if (n &amp;&amp; !input.disabled &amp;&amp; input.type == 'image') {
+                        a.push({name: n, value: $input.val()});
+                        a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+                }
+        }
+        return a;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Serializes form data into a 'submittable' string. This method will return a string
</span><span class="cx">  * in the format: name1=value1&amp;amp;name2=value2
</span><del>- *
- * The semantic argument can be used to force form serialization in semantic order.
- * If your form must be submitted with name/value pairs in semantic order then pass
- * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
- * this logic (which can be significant for very large forms).
- *
- * @example var data = $(&quot;#myForm&quot;).formSerialize();
- * $.ajax('POST', &quot;myscript.cgi&quot;, data);
- * @desc Collect all the data from a form into a single string
- *
- * @name formSerialize
- * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
- * @type String
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fn.formSerialize = function(semantic) {
</span><del>-    //hand off to jQuery.param for proper encoding
-    return $.param(this.formToArray(semantic));
</del><ins>+        //hand off to jQuery.param for proper encoding
+        return $.param(this.formToArray(semantic));
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Serializes all field elements in the jQuery object into a query string.
</span><span class="cx">  * This method will return a string in the format: name1=value1&amp;amp;name2=value2
</span><del>- *
- * The successful argument controls whether or not serialization is limited to
- * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.
- *
- * @example var data = $(&quot;input&quot;).formSerialize();
- * @desc Collect the data from all successful input elements into a query string
- *
- * @example var data = $(&quot;:radio&quot;).formSerialize();
- * @desc Collect the data from all successful radio input elements into a query string
- *
- * @example var data = $(&quot;#myForm :checkbox&quot;).formSerialize();
- * @desc Collect the data from all successful checkbox input elements in myForm into a query string
- *
- * @example var data = $(&quot;#myForm :checkbox&quot;).formSerialize(false);
- * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
- *
- * @example var data = $(&quot;:input&quot;).formSerialize();
- * @desc Collect the data from all successful input, select, textarea and button elements into a query string
- *
- * @name fieldSerialize
- * @param successful true if only successful controls should be serialized (default is true)
- * @type String
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fn.fieldSerialize = function(successful) {
</span><del>-    var a = [];
-    this.each(function() {
-        var n = this.name;
-        if (!n) return;
-        var v = $.fieldValue(this, successful);
-        if (v &amp;&amp; v.constructor == Array) {
-            for (var i=0,max=v.length; i &lt; max; i++)
-                a.push({name: n, value: v[i]});
-        }
-        else if (v !== null &amp;&amp; typeof v != 'undefined')
-            a.push({name: this.name, value: v});
-    });
-    //hand off to jQuery.param for proper encoding
-    return $.param(a);
</del><ins>+        var a = [];
+        this.each(function() {
+                var n = this.name;
+                if (!n) {
+                        return;
+                }
+                var v = $.fieldValue(this, successful);
+                if (v &amp;&amp; v.constructor == Array) {
+                        for (var i=0,max=v.length; i &lt; max; i++) {
+                                a.push({name: n, value: v[i]});
+                        }
+                }
+                else if (v !== null &amp;&amp; typeof v != 'undefined') {
+                        a.push({name: this.name, value: v});
+                }
+        });
+        //hand off to jQuery.param for proper encoding
+        return $.param(a);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Returns the value(s) of the element in the matched set.  For example, consider the following form:
</span><span class="cx">  *
</span><span class="cx">  *  &lt;form&gt;&lt;fieldset&gt;
</span><del>- *      &lt;input name=&quot;A&quot; type=&quot;text&quot; /&gt;
- *      &lt;input name=&quot;A&quot; type=&quot;text&quot; /&gt;
- *      &lt;input name=&quot;B&quot; type=&quot;checkbox&quot; value=&quot;B1&quot; /&gt;
- *      &lt;input name=&quot;B&quot; type=&quot;checkbox&quot; value=&quot;B2&quot;/&gt;
- *      &lt;input name=&quot;C&quot; type=&quot;radio&quot; value=&quot;C1&quot; /&gt;
- *      &lt;input name=&quot;C&quot; type=&quot;radio&quot; value=&quot;C2&quot; /&gt;
</del><ins>+ *          &lt;input name=&quot;A&quot; type=&quot;text&quot; /&gt;
+ *          &lt;input name=&quot;A&quot; type=&quot;text&quot; /&gt;
+ *          &lt;input name=&quot;B&quot; type=&quot;checkbox&quot; value=&quot;B1&quot; /&gt;
+ *          &lt;input name=&quot;B&quot; type=&quot;checkbox&quot; value=&quot;B2&quot;/&gt;
+ *          &lt;input name=&quot;C&quot; type=&quot;radio&quot; value=&quot;C1&quot; /&gt;
+ *          &lt;input name=&quot;C&quot; type=&quot;radio&quot; value=&quot;C2&quot; /&gt;
</ins><span class="cx">  *  &lt;/fieldset&gt;&lt;/form&gt;
</span><span class="cx">  *
</span><span class="cx">  *  var v = $(':text').fieldValue();
</span><span class="lines">@@ -666,95 +671,62 @@
</span><span class="cx">  * for each element is returned.
</span><span class="cx">  *
</span><span class="cx">  * Note: This method *always* returns an array.  If no valid value can be determined the
</span><del>- *       array will be empty, otherwise it will contain one or more values.
- *
- * @example var data = $(&quot;#myPasswordElement&quot;).fieldValue();
- * alert(data[0]);
- * @desc Alerts the current value of the myPasswordElement element
- *
- * @example var data = $(&quot;#myForm :input&quot;).fieldValue();
- * @desc Get the value(s) of the form elements in myForm
- *
- * @example var data = $(&quot;#myForm :checkbox&quot;).fieldValue();
- * @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
- *
- * @example var data = $(&quot;#mySingleSelect&quot;).fieldValue();
- * @desc Get the value(s) of the select control
- *
- * @example var data = $(':text').fieldValue();
- * @desc Get the value(s) of the text input or textarea elements
- *
- * @example var data = $(&quot;#myMultiSelect&quot;).fieldValue();
- * @desc Get the values for the select-multiple control
- *
- * @name fieldValue
- * @param Boolean successful true if only the values for successful controls should be returned (default is true)
- * @type Array&lt;String&gt;
- * @cat Plugins/Form
</del><ins>+ *           array will be empty, otherwise it will contain one or more values.
</ins><span class="cx">  */
</span><span class="cx"> $.fn.fieldValue = function(successful) {
</span><del>-    for (var val=[], i=0, max=this.length; i &lt; max; i++) {
-        var el = this[i];
-        var v = $.fieldValue(el, successful);
-        if (v === null || typeof v == 'undefined' || (v.constructor == Array &amp;&amp; !v.length))
-            continue;
-        v.constructor == Array ? $.merge(val, v) : val.push(v);
-    }
-    return val;
</del><ins>+        for (var val=[], i=0, max=this.length; i &lt; max; i++) {
+                var el = this[i];
+                var v = $.fieldValue(el, successful);
+                if (v === null || typeof v == 'undefined' || (v.constructor == Array &amp;&amp; !v.length)) {
+                        continue;
+                }
+                v.constructor == Array ? $.merge(val, v) : val.push(v);
+        }
+        return val;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Returns the value of the field element.
</span><del>- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true.  If the given element is not
- * successful and the successful arg is not false then the returned value will be null.
- *
- * Note: If the successful flag is true (default) but the element is not successful, the return will be null
- * Note: The value returned for a successful select-multiple element will always be an array.
- * Note: If the element has no value the return value will be undefined.
- *
- * @example var data = jQuery.fieldValue($(&quot;#myPasswordElement&quot;)[0]);
- * @desc Gets the current value of the myPasswordElement element
- *
- * @name fieldValue
- * @param Element el The DOM element for which the value will be returned
- * @param Boolean successful true if value returned must be for a successful controls (default is true)
- * @type String or Array&lt;String&gt; or null or undefined
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fieldValue = function(el, successful) {
</span><del>-    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
-    if (typeof successful == 'undefined') successful = true;
</del><ins>+        var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+        if (successful === undefined) {
+                successful = true;
+        }
</ins><span class="cx"> 
</span><del>-    if (successful &amp;&amp; (!n || el.disabled || t == 'reset' || t == 'button' ||
-        (t == 'checkbox' || t == 'radio') &amp;&amp; !el.checked ||
-        (t == 'submit' || t == 'image') &amp;&amp; el.form &amp;&amp; el.form.clk != el ||
-        tag == 'select' &amp;&amp; el.selectedIndex == -1))
-            return null;
</del><ins>+        if (successful &amp;&amp; (!n || el.disabled || t == 'reset' || t == 'button' ||
+                (t == 'checkbox' || t == 'radio') &amp;&amp; !el.checked ||
+                (t == 'submit' || t == 'image') &amp;&amp; el.form &amp;&amp; el.form.clk != el ||
+                tag == 'select' &amp;&amp; el.selectedIndex == -1)) {
+                        return null;
+        }
</ins><span class="cx"> 
</span><del>-    if (tag == 'select') {
-        var index = el.selectedIndex;
-        if (index &lt; 0) return null;
-        var a = [], ops = el.options;
-        var one = (t == 'select-one');
-        var max = (one ? index+1 : ops.length);
-        for(var i=(one ? index : 0); i &lt; max; i++) {
-            var op = ops[i];
-            if (op.selected) {
-                // extra pain for IE...
-                var v = $.browser.msie &amp;&amp; !(op.attributes['value'].specified) ? op.text : op.value;
-                if (one) return v;
-                a.push(v);
-            }
-        }
-        return a;
-    }
-    return el.value;
</del><ins>+        if (tag == 'select') {
+                var index = el.selectedIndex;
+                if (index &lt; 0) {
+                        return null;
+                }
+                var a = [], ops = el.options;
+                var one = (t == 'select-one');
+                var max = (one ? index+1 : ops.length);
+                for(var i=(one ? index : 0); i &lt; max; i++) {
+                        var op = ops[i];
+                        if (op.selected) {
+                                var v = op.value;
+                                if (!v) { // extra pain for IE...
+                                        v = (op.attributes &amp;&amp; op.attributes['value'] &amp;&amp; !(op.attributes['value'].specified)) ? op.text : op.value;
+                                }
+                                if (one) {
+                                        return v;
+                                }
+                                a.push(v);
+                        }
+                }
+                return a;
+        }
+        return $(el).val();
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Clears the form data.  Takes the following actions on the form's input fields:
</span><span class="cx">  *  - input text fields will have their 'value' property set to the empty string
</span><span class="lines">@@ -762,111 +734,93 @@
</span><span class="cx">  *  - checkbox and radio inputs will have their 'checked' property set to false
</span><span class="cx">  *  - inputs of type submit, button, reset, and hidden will *not* be effected
</span><span class="cx">  *  - button elements will *not* be effected
</span><del>- *
- * @example $('form').clearForm();
- * @desc Clears all forms on the page.
- *
- * @name clearForm
- * @type jQuery
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fn.clearForm = function() {
</span><del>-    return this.each(function() {
-        $('input,select,textarea', this).clearFields();
-    });
</del><ins>+        return this.each(function() {
+                $('input,select,textarea', this).clearFields();
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Clears the selected form elements.  Takes the following actions on the matched elements:
- *  - input text fields will have their 'value' property set to the empty string
- *  - select elements will have their 'selectedIndex' property set to -1
- *  - checkbox and radio inputs will have their 'checked' property set to false
- *  - inputs of type submit, button, reset, and hidden will *not* be effected
- *  - button elements will *not* be effected
- *
- * @example $('.myInputs').clearFields();
- * @desc Clears all inputs with class myInputs
- *
- * @name clearFields
- * @type jQuery
- * @cat Plugins/Form
</del><ins>+ * Clears the selected form elements.
</ins><span class="cx">  */
</span><span class="cx"> $.fn.clearFields = $.fn.clearInputs = function() {
</span><del>-    return this.each(function() {
-        var t = this.type, tag = this.tagName.toLowerCase();
-        if (t == 'text' || t == 'password' || tag == 'textarea')
-            this.value = '';
-        else if (t == 'checkbox' || t == 'radio')
-            this.checked = false;
-        else if (tag == 'select')
-            this.selectedIndex = -1;
-    });
</del><ins>+        return this.each(function() {
+                var t = this.type, tag = this.tagName.toLowerCase();
+                if (t == 'text' || t == 'password' || tag == 'textarea') {
+                        this.value = '';
+                }
+                else if (t == 'checkbox' || t == 'radio') {
+                        this.checked = false;
+                }
+                else if (tag == 'select') {
+                        this.selectedIndex = -1;
+                }
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Resets the form data.  Causes all form elements to be reset to their original value.
</span><del>- *
- * @example $('form').resetForm();
- * @desc Resets all forms on the page.
- *
- * @name resetForm
- * @type jQuery
- * @cat Plugins/Form
</del><span class="cx">  */
</span><span class="cx"> $.fn.resetForm = function() {
</span><del>-    return this.each(function() {
-        // guard against an input with the name of 'reset'
-        // note that IE reports the reset function as an 'object'
-        if (typeof this.reset == 'function' || (typeof this.reset == 'object' &amp;&amp; !this.reset.nodeType))
-            this.reset();
-    });
</del><ins>+        return this.each(function() {
+                // guard against an input with the name of 'reset'
+                // note that IE reports the reset function as an 'object'
+                if (typeof this.reset == 'function' || (typeof this.reset == 'object' &amp;&amp; !this.reset.nodeType)) {
+                        this.reset();
+                }
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * Enables or disables any matching elements.
</span><del>- *
- * @example $(':radio').enabled(false);
- * @desc Disables all radio buttons
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
</del><span class="cx">  */
</span><del>-$.fn.enable = function(b) { 
-    if (b == undefined) b = true;
-    return this.each(function() { 
-        this.disabled = !b 
-    });
</del><ins>+$.fn.enable = function(b) {
+        if (b === undefined) {
+                b = true;
+        }
+        return this.each(function() {
+                this.disabled = !b;
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Checks/unchecks any matching checkboxes or radio buttons and
</span><span class="cx">  * selects/deselects and matching option elements.
</span><del>- *
- * @example $(':checkbox').selected();
- * @desc Checks all checkboxes
- *
- * @name select
- * @type jQuery
- * @cat Plugins/Form
</del><span class="cx">  */
</span><del>-$.fn.select = function(select) {
-    if (select == undefined) select = true;
-    return this.each(function() { 
-        var t = this.type;
-        if (t == 'checkbox' || t == 'radio')
-            this.checked = select;
-        else if (this.tagName.toLowerCase() == 'option') {
-            var $sel = $(this).parent('select');
-            if (select &amp;&amp; $sel[0] &amp;&amp; $sel[0].type == 'select-one') {
-                // deselect all other options
-                $sel.find('option').select(false);
-            }
-            this.selected = select;
-        }
-    });
</del><ins>+$.fn.selected = function(select) {
+        if (select === undefined) {
+                select = true;
+        }
+        return this.each(function() {
+                var t = this.type;
+                if (t == 'checkbox' || t == 'radio') {
+                        this.checked = select;
+                }
+                else if (this.tagName.toLowerCase() == 'option') {
+                        var $sel = $(this).parent('select');
+                        if (select &amp;&amp; $sel[0] &amp;&amp; $sel[0].type == 'select-one') {
+                                // deselect all other options
+                                $sel.find('option').selected(false);
+                        }
+                        this.selected = select;
+                }
+        });
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+// helper fn for console logging
+// set $.fn.ajaxSubmit.debug to true to enable debug logging
+function log() {
+        if ($.fn.ajaxSubmit.debug) {
+                var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
+                if (window.console &amp;&amp; window.console.log) {
+                        window.console.log(msg);
+                }
+                else if (window.opera &amp;&amp; window.opera.postError) {
+                        window.opera.postError(msg);
+                }
+        }
+};
+
</ins><span class="cx"> })(jQuery);
</span><ins>+
</ins></span></pre></div>
<a id="trunkwpincludesjsjqueryjqueryformjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/jquery/jquery.form.js (17943 => 17944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/jquery/jquery.form.js        2011-05-17 06:19:00 UTC (rev 17943)
+++ trunk/wp-includes/js/jquery/jquery.form.js        2011-05-17 14:22:50 UTC (rev 17944)
</span><span class="lines">@@ -1 +1,11 @@
</span><del>-(function($){$.fn.ajaxSubmit=function(options){if(typeof options==&quot;function&quot;){options={success:options}}options=$.extend({url:this.attr(&quot;action&quot;)||window.location.toString(),type:this.attr(&quot;method&quot;)||&quot;GET&quot;},options||{});var veto={};$.event.trigger(&quot;form.pre.serialize&quot;,[this,options,veto]);if(veto.veto){return this}var a=this.formToArray(options.semantic);if(options.data){for(var n in options.data){a.push({name:n,value:options.data[n]})}}if(options.beforeSubmit&amp;&amp;options.beforeSubmit(a,this,options)===false){return this}$.event.trigger(&quot;form.submit.validate&quot;,[a,this,options,veto]);if(veto.veto){return this}var q=$.param(a);if(options.type.toUpperCase()==&quot;GET&quot;){options.url+=(options.url.indexOf(&quot;?&quot;)&gt;=0?&quot;&amp;&quot;:&quot;?&quot;)+q;options.data=null}else{options.data=q}var $form=this,callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm()})}if(optio
 ns.clearForm){callbacks.push(function(){$form.clearForm()})}if(!options.dataType&amp;&amp;options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){if(this.evalScripts){$(options.target).attr(&quot;innerHTML&quot;,data).evalScripts().each(oldSuccess,arguments)}else{$(options.target).html(data).each(oldSuccess,arguments)}})}else{if(options.success){callbacks.push(options.success)}}options.success=function(data,status){for(var i=0,max=callbacks.length;i&lt;max;i++){callbacks[i](data,status,$form)}};var files=$(&quot;input:file&quot;,this).fieldValue();var found=false;for(var j=0;j&lt;files.length;j++){if(files[j]){found=true}}if(options.iframe||found){if($.browser.safari&amp;&amp;options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload)}else{fileUpload()}}else{$.ajax(options)}$.event.trigger(&quot;form.submit.notify&quot;,[this,options]);return this;function fileUpload(){var form=$form[0];var opts=$.extend({},$.ajaxSettings,options);var 
 id=&quot;jqFormIO&quot;+$.fn.ajaxSubmit.counter++;var $io=$('&lt;iframe id=&quot;'+id+'&quot; name=&quot;'+id+'&quot; /&gt;');var io=$io[0];var op8=$.browser.opera&amp;&amp;window.opera.version()&lt;9;if($.browser.msie||op8){io.src='javascript:false;document.write(&quot;&quot;);'}$io.css({position:&quot;absolute&quot;,top:&quot;-1000px&quot;,left:&quot;-1000px&quot;});var xhr={responseText:null,responseXML:null,status:0,statusText:&quot;n/a&quot;,getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}};var g=opts.global;if(g&amp;&amp;!$.active++){$.event.trigger(&quot;ajaxStart&quot;)}if(g){$.event.trigger(&quot;ajaxSend&quot;,[xhr,opts])}var cbInvoked=0;var timedOut=0;setTimeout(function(){var encAttr=form.encoding?&quot;encoding&quot;:&quot;enctype&quot;;var t=$form.attr(&quot;target&quot;);$form.attr({target:id,method:&quot;POST&quot;,action:opts.url});form[encAttr]=&quot;multipart/form-data&quot;;if(opts.timeout){setTimeout(functio
 n(){timedOut=true;cb()},opts.timeout)}$io.appendTo(&quot;body&quot;);io.attachEvent?io.attachEvent(&quot;onload&quot;,cb):io.addEventListener(&quot;load&quot;,cb,false);form.submit();$form.attr(&quot;target&quot;,t)},10);function cb(){if(cbInvoked++){return}io.detachEvent?io.detachEvent(&quot;onload&quot;,cb):io.removeEventListener(&quot;load&quot;,cb,false);var ok=true;try{if(timedOut){throw&quot;timeout&quot;}var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;if(opts.dataType==&quot;json&quot;||opts.dataType==&quot;script&quot;){var ta=doc.getElementsByTagName(&quot;textarea&quot;)[0];data=ta?ta.value:xhr.responseText;if(opts.dataType==&quot;json&quot;){eval(&quot;data = &quot;+data)}else{$.globalEval(data)}}else{if(opts.dataType==&quot;xml&quot;){data=xhr.responseXML;if(!data&amp;&amp;xhr.responseText!=null){data=
 toXml(xhr.responseText)}}else{data=xhr.responseText}}}catch(e){ok=false;$.handleError(opts,xhr,&quot;error&quot;,e)}if(ok){opts.success(data,&quot;success&quot;);if(g){$.event.trigger(&quot;ajaxSuccess&quot;,[xhr,opts])}}if(g){$.event.trigger(&quot;ajaxComplete&quot;,[xhr,opts])}if(g&amp;&amp;!--$.active){$.event.trigger(&quot;ajaxStop&quot;)}if(opts.complete){opts.complete(xhr,ok?&quot;success&quot;:&quot;error&quot;)}setTimeout(function(){$io.remove();xhr.responseXML=null},100)}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);doc.async=&quot;false&quot;;doc.loadXML(s)}else{doc=(new DOMParser()).parseFromString(s,&quot;text/xml&quot;)}return(doc&amp;&amp;doc.documentElement&amp;&amp;doc.documentElement.tagName!=&quot;parsererror&quot;)?doc:null}}};$.fn.ajaxSubmit.counter=0;$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().submit(submitHandler).each(function(){this.formPluginId=$.fn.ajaxForm.counter++;$.fn.ajaxForm
 .optionHash[this.formPluginId]=options;$(&quot;:submit,input:image&quot;,this).click(clickHandler)})};$.fn.ajaxForm.counter=1;$.fn.ajaxForm.optionHash={};function clickHandler(e){var $form=this.form;$form.clk=this;if(this.type==&quot;image&quot;){if(e.offsetX!=undefined){$form.clk_x=e.offsetX;$form.clk_y=e.offsetY}else{if(typeof $.fn.offset==&quot;function&quot;){var offset=$(this).offset();$form.clk_x=e.pageX-offset.left;$form.clk_y=e.pageY-offset.top}else{$form.clk_x=e.pageX-this.offsetLeft;$form.clk_y=e.pageY-this.offsetTop}}}setTimeout(function(){$form.clk=$form.clk_x=$form.clk_y=null},10)}function submitHandler(){var id=this.formPluginId;var options=$.fn.ajaxForm.optionHash[id];$(this).ajaxSubmit(options);return false}$.fn.ajaxFormUnbind=function(){this.unbind(&quot;submit&quot;,submitHandler);return this.each(function(){$(&quot;:submit,input:image&quot;,this).unbind(&quot;click&quot;,clickHandler)})};$.fn.formToArray=function(semantic){var a=[];if(this.length==0){retur
 n a}var form=this[0];var els=semantic?form.getElementsByTagName(&quot;*&quot;):form.elements;if(!els){return a}for(var i=0,max=els.length;i&lt;max;i++){var el=els[i];var n=el.name;if(!n){continue}if(semantic&amp;&amp;form.clk&amp;&amp;el.type==&quot;image&quot;){if(!el.disabled&amp;&amp;form.clk==el){a.push({name:n+&quot;.x&quot;,value:form.clk_x},{name:n+&quot;.y&quot;,value:form.clk_y})}continue}var v=$.fieldValue(el,true);if(v&amp;&amp;v.constructor==Array){for(var j=0,jmax=v.length;j&lt;jmax;j++){a.push({name:n,value:v[j]})}}else{if(v!==null&amp;&amp;typeof v!=&quot;undefined&quot;){a.push({name:n,value:v})}}}if(!semantic&amp;&amp;form.clk){var inputs=form.getElementsByTagName(&quot;input&quot;);for(var i=0,max=inputs.length;i&lt;max;i++){var input=inputs[i];var n=input.name;if(n&amp;&amp;!input.disabled&amp;&amp;input.type==&quot;image&quot;&amp;&amp;form.clk==input){a.push({name:n+&quot;.x&quot;,value:form.clk_x},{name:n+&quot;.y&quot;,value:form.clk_y})}}}return a};$.
 fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic))};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return}var v=$.fieldValue(this,successful);if(v&amp;&amp;v.constructor==Array){for(var i=0,max=v.length;i&lt;max;i++){a.push({name:n,value:v[i]})}}else{if(v!==null&amp;&amp;typeof v!=&quot;undefined&quot;){a.push({name:this.name,value:v})}}});return $.param(a)};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i&lt;max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v==&quot;undefined&quot;||(v.constructor==Array&amp;&amp;!v.length)){continue}v.constructor==Array?$.merge(val,v):val.push(v)}return val};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful==&quot;undefined&quot;){successful=true}if(successful&amp;&amp;(!n||el.disabled||t==&quot;reset&quot;||t==&quot;button&quot;||(t==&quot;checkbox&quot
 ;||t==&quot;radio&quot;)&amp;&amp;!el.checked||(t==&quot;submit&quot;||t==&quot;image&quot;)&amp;&amp;el.form&amp;&amp;el.form.clk!=el||tag==&quot;select&quot;&amp;&amp;el.selectedIndex==-1)){return null}if(tag==&quot;select&quot;){var index=el.selectedIndex;if(index&lt;0){return null}var a=[],ops=el.options;var one=(t==&quot;select-one&quot;);var max=(one?index+1:ops.length);for(var i=(one?index:0);i&lt;max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&amp;&amp;!(op.attributes.value.specified)?op.text:op.value;if(one){return v}a.push(v)}}return a}return el.value};$.fn.clearForm=function(){return this.each(function(){$(&quot;input,select,textarea&quot;,this).clearFields()})};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t==&quot;text&quot;||t==&quot;password&quot;||tag==&quot;textarea&quot;){this.value=&quot;&quot;}else{if(t==&quot;checkbox&quot;||t==&quot;radio&quot;){this.checked=false}e
 lse{if(tag==&quot;select&quot;){this.selectedIndex=-1}}}})};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset==&quot;function&quot;||(typeof this.reset==&quot;object&quot;&amp;&amp;!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(b){if(b==undefined){b=true}return this.each(function(){this.disabled=!b})};$.fn.select=function(select){if(select==undefined){select=true}return this.each(function(){var t=this.type;if(t==&quot;checkbox&quot;||t==&quot;radio&quot;){this.checked=select}else{if(this.tagName.toLowerCase()==&quot;option&quot;){var $sel=$(this).parent(&quot;select&quot;);if(select&amp;&amp;$sel[0]&amp;&amp;$sel[0].type==&quot;select-one&quot;){$sel.find(&quot;option&quot;).select(false)}this.selected=select}}})}})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+/*
+ * jQuery Form Plugin
+ * version: 2.73 (03-MAY-2011)
+ * @requires jQuery v1.3.2 or later
+ *
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ */
+(function(b){b.fn.ajaxSubmit=function(t){if(!this.length){a(&quot;ajaxSubmit: skipping submit process - no element selected&quot;);return this}if(typeof t==&quot;function&quot;){t={success:t}}var h=this.attr(&quot;action&quot;);var d=(typeof h===&quot;string&quot;)?b.trim(h):&quot;&quot;;if(d){d=(d.match(/^([^#]+)/)||[])[1]}d=d||window.location.href||&quot;&quot;;t=b.extend(true,{url:d,success:b.ajaxSettings.success,type:this[0].getAttribute(&quot;method&quot;)||&quot;GET&quot;,iframeSrc:/^https/i.test(window.location.href||&quot;&quot;)?&quot;javascript:false&quot;:&quot;about:blank&quot;},t);var u={};this.trigger(&quot;form-pre-serialize&quot;,[this,t,u]);if(u.veto){a(&quot;ajaxSubmit: submit vetoed via form-pre-serialize trigger&quot;);return this}if(t.beforeSerialize&amp;&amp;t.beforeSerialize(this,t)===false){a(&quot;ajaxSubmit: submit aborted via beforeSerialize callback&quot;);return this}var f,p,m=this.formToArray(t.semantic);if(t.data){t.extraData=t.data;for(f in t.
 data){if(t.data[f] instanceof Array){for(var i in t.data[f]){m.push({name:f,value:t.data[f][i]})}}else{p=t.data[f];p=b.isFunction(p)?p():p;m.push({name:f,value:p})}}}if(t.beforeSubmit&amp;&amp;t.beforeSubmit(m,this,t)===false){a(&quot;ajaxSubmit: submit aborted via beforeSubmit callback&quot;);return this}this.trigger(&quot;form-submit-validate&quot;,[m,this,t,u]);if(u.veto){a(&quot;ajaxSubmit: submit vetoed via form-submit-validate trigger&quot;);return this}var c=b.param(m);if(t.type.toUpperCase()==&quot;GET&quot;){t.url+=(t.url.indexOf(&quot;?&quot;)&gt;=0?&quot;&amp;&quot;:&quot;?&quot;)+c;t.data=null}else{t.data=c}var s=this,l=[];if(t.resetForm){l.push(function(){s.resetForm()})}if(t.clearForm){l.push(function(){s.clearForm()})}if(!t.dataType&amp;&amp;t.target){var r=t.success||function(){};l.push(function(n){var k=t.replaceTarget?&quot;replaceWith&quot;:&quot;html&quot;;b(t.target)[k](n).each(r,arguments)})}else{if(t.success){l.push(t.success)}}t.success=function(w,n,x
 ){var v=t.context||t;for(var q=0,k=l.length;q&lt;k;q++){l[q].apply(v,[w,n,x||s,s])}};var g=b(&quot;input:file&quot;,this).length&gt;0;var e=&quot;multipart/form-data&quot;;var j=(s.attr(&quot;enctype&quot;)==e||s.attr(&quot;encoding&quot;)==e);if(t.iframe!==false&amp;&amp;(g||t.iframe||j)){if(t.closeKeepAlive){b.get(t.closeKeepAlive,o)}else{o()}}else{b.ajax(t)}this.trigger(&quot;form-submit-notify&quot;,[this,t]);return this;function o(){var v=s[0];if(b(&quot;:input[name=submit],:input[id=submit]&quot;,v).length){alert('Error: Form elements must not have name or id of &quot;submit&quot;.');return}var D=b.extend(true,{},b.ajaxSettings,t);D.context=D.context||D;var G=&quot;jqFormIO&quot;+(new Date().getTime()),A=&quot;_&quot;+G;var x=b('&lt;iframe id=&quot;'+G+'&quot; name=&quot;'+G+'&quot; src=&quot;'+D.iframeSrc+'&quot; /&gt;');var B=x[0];x.css({position:&quot;absolute&quot;,top:&quot;-1000px&quot;,left:&quot;-1000px&quot;});var y={aborted:0,responseText:null,responseXML:nul
 l,status:0,statusText:&quot;n/a&quot;,getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(n){var O=(n===&quot;timeout&quot;?&quot;timeout&quot;:&quot;aborted&quot;);a(&quot;aborting upload... &quot;+O);this.aborted=1;x.attr(&quot;src&quot;,D.iframeSrc);y.error=O;D.error&amp;&amp;D.error.call(D.context,y,O,O);K&amp;&amp;b.event.trigger(&quot;ajaxError&quot;,[y,D,O]);D.complete&amp;&amp;D.complete.call(D.context,y,O)}};var K=D.global;if(K&amp;&amp;!b.active++){b.event.trigger(&quot;ajaxStart&quot;)}if(K){b.event.trigger(&quot;ajaxSend&quot;,[y,D])}if(D.beforeSend&amp;&amp;D.beforeSend.call(D.context,y,D)===false){if(D.global){b.active--}return}if(y.aborted){return}var J=0,C;var z=v.clk;if(z){var H=z.name;if(H&amp;&amp;!z.disabled){D.extraData=D.extraData||{};D.extraData[H]=z.value;if(z.type==&quot;image&quot;){D.extraData[H+&quot;.x&quot;]=v.clk_x;D.extraData[H+&quot;.y&quot;]=v.clk_y}}}function I(){var Q=s.attr(&quot;
 target&quot;),O=s.attr(&quot;action&quot;);v.setAttribute(&quot;target&quot;,G);if(v.getAttribute(&quot;method&quot;)!=&quot;POST&quot;){v.setAttribute(&quot;method&quot;,&quot;POST&quot;)}if(v.getAttribute(&quot;action&quot;)!=D.url){v.setAttribute(&quot;action&quot;,D.url)}if(!D.skipEncodingOverride){s.attr({encoding:&quot;multipart/form-data&quot;,enctype:&quot;multipart/form-data&quot;})}if(D.timeout){C=setTimeout(function(){J=true;F(true)},D.timeout)}var P=[];try{if(D.extraData){for(var R in D.extraData){P.push(b('&lt;input type=&quot;hidden&quot; name=&quot;'+R+'&quot; value=&quot;'+D.extraData[R]+'&quot; /&gt;').appendTo(v)[0])}}x.appendTo(&quot;body&quot;);B.attachEvent?B.attachEvent(&quot;onload&quot;,F):B.addEventListener(&quot;load&quot;,F,false);v.submit()}finally{v.setAttribute(&quot;action&quot;,O);if(Q){v.setAttribute(&quot;target&quot;,Q)}else{s.removeAttr(&quot;target&quot;)}b(P).remove()}}if(D.forceSync){I()}else{setTimeout(I,10)}var M,N,L=50,w;function F(T
 ){if(y.aborted||w){return}if(T===true&amp;&amp;y){y.abort(&quot;timeout&quot;);return}var S=B.contentWindow?B.contentWindow.document:B.contentDocument?B.contentDocument:B.document;if(!S||S.location.href==D.iframeSrc){if(!J){return}}B.detachEvent?B.detachEvent(&quot;onload&quot;,F):B.removeEventListener(&quot;load&quot;,F,false);var P=true;try{if(J){throw&quot;timeout&quot;}var U=D.dataType==&quot;xml&quot;||S.XMLDocument||b.isXMLDoc(S);a(&quot;isXml=&quot;+U);if(!U&amp;&amp;window.opera&amp;&amp;(S.body==null||S.body.innerHTML==&quot;&quot;)){if(--L){a(&quot;requeing onLoad callback, DOM not available&quot;);setTimeout(F,250);return}}y.responseText=S.body?S.body.innerHTML:S.documentElement?S.documentElement.innerHTML:null;y.responseXML=S.XMLDocument?S.XMLDocument:S;if(U){D.dataType=&quot;xml&quot;}y.getResponseHeader=function(W){var V={&quot;content-type&quot;:D.dataType};return V[W]};var R=/(json|script|text)/.test(D.dataType);if(R||D.textarea){var O=S.getElementsByTagName(
 &quot;textarea&quot;)[0];if(O){y.responseText=O.value}else{if(R){var Q=S.getElementsByTagName(&quot;pre&quot;)[0];var n=S.getElementsByTagName(&quot;body&quot;)[0];if(Q){y.responseText=Q.textContent}else{if(n){y.responseText=n.innerHTML}}}}}else{if(D.dataType==&quot;xml&quot;&amp;&amp;!y.responseXML&amp;&amp;y.responseText!=null){y.responseXML=E(y.responseText)}}M=k(y,D.dataType,D)}catch(T){a(&quot;error caught:&quot;,T);P=false;y.error=T;D.error&amp;&amp;D.error.call(D.context,y,&quot;error&quot;,T);K&amp;&amp;b.event.trigger(&quot;ajaxError&quot;,[y,D,T])}if(y.aborted){a(&quot;upload aborted&quot;);P=false}if(P){D.success&amp;&amp;D.success.call(D.context,M,&quot;success&quot;,y);K&amp;&amp;b.event.trigger(&quot;ajaxSuccess&quot;,[y,D])}K&amp;&amp;b.event.trigger(&quot;ajaxComplete&quot;,[y,D]);if(K&amp;&amp;!--b.active){b.event.trigger(&quot;ajaxStop&quot;)}D.complete&amp;&amp;D.complete.call(D.context,y,P?&quot;success&quot;:&quot;error&quot;);w=true;if(D.timeout){clearT
 imeout(C)}setTimeout(function(){x.removeData(&quot;form-plugin-onload&quot;);x.remove();y.responseXML=null},100)}var E=b.parseXML||function(n,O){if(window.ActiveXObject){O=new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);O.async=&quot;false&quot;;O.loadXML(n)}else{O=(new DOMParser()).parseFromString(n,&quot;text/xml&quot;)}return(O&amp;&amp;O.documentElement&amp;&amp;O.documentElement.nodeName!=&quot;parsererror&quot;)?O:null};var q=b.parseJSON||function(n){return window[&quot;eval&quot;](&quot;(&quot;+n+&quot;)&quot;)};var k=function(S,Q,P){var O=S.getResponseHeader(&quot;content-type&quot;)||&quot;&quot;,n=Q===&quot;xml&quot;||!Q&amp;&amp;O.indexOf(&quot;xml&quot;)&gt;=0,R=n?S.responseXML:S.responseText;if(n&amp;&amp;R.documentElement.nodeName===&quot;parsererror&quot;){b.error&amp;&amp;b.error(&quot;parsererror&quot;)}if(P&amp;&amp;P.dataFilter){R=P.dataFilter(R,Q)}if(typeof R===&quot;string&quot;){if(Q===&quot;json&quot;||!Q&amp;&amp;O.indexOf(&quot;json&quot;)&gt;=0){R=q
 (R)}else{if(Q===&quot;script&quot;||!Q&amp;&amp;O.indexOf(&quot;javascript&quot;)&gt;=0){b.globalEval(R)}}}return R}}};b.fn.ajaxForm=function(c){if(this.length===0){var d={s:this.selector,c:this.context};if(!b.isReady&amp;&amp;d.s){a(&quot;DOM not ready, queuing ajaxForm&quot;);b(function(){b(d.s,d.c).ajaxForm(c)});return this}a(&quot;terminating; zero elements found by selector&quot;+(b.isReady?&quot;&quot;:&quot; (DOM not ready)&quot;));return this}return this.ajaxFormUnbind().bind(&quot;submit.form-plugin&quot;,function(f){if(!f.isDefaultPrevented()){f.preventDefault();b(this).ajaxSubmit(c)}}).bind(&quot;click.form-plugin&quot;,function(j){var i=j.target;var g=b(i);if(!(g.is(&quot;:submit,input:image&quot;))){var f=g.closest(&quot;:submit&quot;);if(f.length==0){return}i=f[0]}var h=this;h.clk=i;if(i.type==&quot;image&quot;){if(j.offsetX!=undefined){h.clk_x=j.offsetX;h.clk_y=j.offsetY}else{if(typeof b.fn.offset==&quot;function&quot;){var k=g.offset();h.clk_x=j.pageX-k.left;
 h.clk_y=j.pageY-k.top}else{h.clk_x=j.pageX-i.offsetLeft;h.clk_y=j.pageY-i.offsetTop}}}setTimeout(function(){h.clk=h.clk_x=h.clk_y=null},100)})};b.fn.ajaxFormUnbind=function(){return this.unbind(&quot;submit.form-plugin click.form-plugin&quot;)};b.fn.formToArray=function(q){var p=[];if(this.length===0){return p}var d=this[0];var g=q?d.getElementsByTagName(&quot;*&quot;):d.elements;if(!g){return p}var k,h,f,r,e,m,c;for(k=0,m=g.length;k&lt;m;k++){e=g[k];f=e.name;if(!f){continue}if(q&amp;&amp;d.clk&amp;&amp;e.type==&quot;image&quot;){if(!e.disabled&amp;&amp;d.clk==e){p.push({name:f,value:b(e).val()});p.push({name:f+&quot;.x&quot;,value:d.clk_x},{name:f+&quot;.y&quot;,value:d.clk_y})}continue}r=b.fieldValue(e,true);if(r&amp;&amp;r.constructor==Array){for(h=0,c=r.length;h&lt;c;h++){p.push({name:f,value:r[h]})}}else{if(r!==null&amp;&amp;typeof r!=&quot;undefined&quot;){p.push({name:f,value:r})}}}if(!q&amp;&amp;d.clk){var l=b(d.clk),o=l[0];f=o.name;if(f&amp;&amp;!o.disabled&amp;&amp
 ;o.type==&quot;image&quot;){p.push({name:f,value:l.val()});p.push({name:f+&quot;.x&quot;,value:d.clk_x},{name:f+&quot;.y&quot;,value:d.clk_y})}}return p};b.fn.formSerialize=function(c){return b.param(this.formToArray(c))};b.fn.fieldSerialize=function(d){var c=[];this.each(function(){var h=this.name;if(!h){return}var f=b.fieldValue(this,d);if(f&amp;&amp;f.constructor==Array){for(var g=0,e=f.length;g&lt;e;g++){c.push({name:h,value:f[g]})}}else{if(f!==null&amp;&amp;typeof f!=&quot;undefined&quot;){c.push({name:this.name,value:f})}}});return b.param(c)};b.fn.fieldValue=function(h){for(var g=[],e=0,c=this.length;e&lt;c;e++){var f=this[e];var d=b.fieldValue(f,h);if(d===null||typeof d==&quot;undefined&quot;||(d.constructor==Array&amp;&amp;!d.length)){continue}d.constructor==Array?b.merge(g,d):g.push(d)}return g};b.fieldValue=function(c,j){var e=c.name,p=c.type,q=c.tagName.toLowerCase();if(j===undefined){j=true}if(j&amp;&amp;(!e||c.disabled||p==&quot;reset&quot;||p==&quot;button&quo
 t;||(p==&quot;checkbox&quot;||p==&quot;radio&quot;)&amp;&amp;!c.checked||(p==&quot;submit&quot;||p==&quot;image&quot;)&amp;&amp;c.form&amp;&amp;c.form.clk!=c||q==&quot;select&quot;&amp;&amp;c.selectedIndex==-1)){return null}if(q==&quot;select&quot;){var k=c.selectedIndex;if(k&lt;0){return null}var m=[],d=c.options;var g=(p==&quot;select-one&quot;);var l=(g?k+1:d.length);for(var f=(g?k:0);f&lt;l;f++){var h=d[f];if(h.selected){var o=h.value;if(!o){o=(h.attributes&amp;&amp;h.attributes.value&amp;&amp;!(h.attributes.value.specified))?h.text:h.value}if(g){return o}m.push(o)}}return m}return b(c).val()};b.fn.clearForm=function(){return this.each(function(){b(&quot;input,select,textarea&quot;,this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d==&quot;text&quot;||d==&quot;password&quot;||c==&quot;textarea&quot;){this.value=&quot;&quot;}else{if(d==&quot;checkbox&quot;||d==&quot;radio&quot;){
 this.checked=false}else{if(c==&quot;select&quot;){this.selectedIndex=-1}}}})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset==&quot;function&quot;||(typeof this.reset==&quot;object&quot;&amp;&amp;!this.reset.nodeType)){this.reset()}})};b.fn.enable=function(c){if(c===undefined){c=true}return this.each(function(){this.disabled=!c})};b.fn.selected=function(c){if(c===undefined){c=true}return this.each(function(){var d=this.type;if(d==&quot;checkbox&quot;||d==&quot;radio&quot;){this.checked=c}else{if(this.tagName.toLowerCase()==&quot;option&quot;){var e=b(this).parent(&quot;select&quot;);if(c&amp;&amp;e[0]&amp;&amp;e[0].type==&quot;select-one&quot;){e.find(&quot;option&quot;).selected(false)}this.selected=c}}})};function a(){if(b.fn.ajaxSubmit.debug){var c=&quot;[jquery.form] &quot;+Array.prototype.join.call(arguments,&quot;&quot;);if(window.console&amp;&amp;window.console.log){window.console.log(c)}else{if(window.opera&amp;&amp;window.opera.postError)
 {window.opera.postError(c)}}}}})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (17943 => 17944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2011-05-17 06:19:00 UTC (rev 17943)
+++ trunk/wp-includes/script-loader.php        2011-05-17 14:22:50 UTC (rev 17944)
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">         $scripts-&gt;add_data( 'jquery-ui-dialog', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">         // deprecated, not used in core, most functionality is included in jQuery 1.3
</span><del>-        $scripts-&gt;add( 'jquery-form', &quot;/wp-includes/js/jquery/jquery.form$suffix.js&quot;, array('jquery'), '2.02m');
</del><ins>+        $scripts-&gt;add( 'jquery-form', &quot;/wp-includes/js/jquery/jquery.form$suffix.js&quot;, array('jquery'), '2.73');
</ins><span class="cx">         $scripts-&gt;add_data( 'jquery-form', 'group', 1 );
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'jquery-color', &quot;/wp-includes/js/jquery/jquery.color$suffix.js&quot;, array('jquery'), '2.0-4561m');
</span></span></pre>
</div>
</div>

</body>
</html>