wp/wp-includes/js/jquery/jquery.form.js
changeset 18 be944660c56a
parent 7 cf61fcea0001
--- a/wp/wp-includes/js/jquery/jquery.form.js	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/js/jquery/jquery.form.js	Wed Sep 21 18:19:35 2022 +0200
@@ -1,12 +1,23 @@
 /*!
  * jQuery Form Plugin
- * version: 4.2.1
- * Requires jQuery v1.7 or later
+ * version: 4.3.0
+ * Requires jQuery v1.7.2 or later
+ * Project repository: https://github.com/jquery-form/form
+
  * Copyright 2017 Kevin Morris
  * Copyright 2006 M. Alsup
- * Project repository: https://github.com/jquery-form/form
- * Dual licensed under the MIT and LGPLv3 licenses.
+
+ * Dual licensed under the LGPL-2.1+ or MIT licenses
  * https://github.com/jquery-form/form#license
+
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  */
 /* global ActiveXObject */
 
@@ -125,7 +136,7 @@
 		}
 
 		/* eslint consistent-this: ["error", "$form"] */
-		var method, action, url, $form = this;
+		var method, action, url, isMsie, iframeSrc, $form = this;
 
 		if (typeof options === 'function') {
 			options = {success: options};
@@ -154,12 +165,16 @@
 			// clean url (don't include hash vaue)
 			url = (url.match(/^([^#]+)/) || [])[1];
 		}
+		// IE requires javascript:false in https, but this breaks chrome >83 and goes against spec.
+		// Instead of using javascript:false always, let's only apply it for IE.
+		isMsie = /(MSIE|Trident)/.test(navigator.userAgent || '');
+		iframeSrc = (isMsie && /^https/i.test(window.location.href || '')) ? 'javascript:false' : 'about:blank'; // eslint-disable-line no-script-url
 
 		options = $.extend(true, {
 			url       : url,
 			success   : $.ajaxSettings.success,
 			type      : method || $.ajaxSettings.type,
-			iframeSrc : /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'		// eslint-disable-line no-script-url
+			iframeSrc : iframeSrc
 		}, options);
 
 		// hook for manipulating the form data before it is extracted;
@@ -654,12 +669,12 @@
 								// if using the $.param format that allows for multiple values with the same name
 								if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
 									extraInputs.push(
-									$('<input type="hidden" name="' + s.extraData[n].name + '">', ownerDocument).val(s.extraData[n].value)
-										.appendTo(form)[0]);
+										$('<input type="hidden" name="' + s.extraData[n].name + '">', ownerDocument).val(s.extraData[n].value)
+											.appendTo(form)[0]);
 								} else {
 									extraInputs.push(
-									$('<input type="hidden" name="' + n + '">', ownerDocument).val(s.extraData[n])
-										.appendTo(form)[0]);
+										$('<input type="hidden" name="' + n + '">', ownerDocument).val(s.extraData[n])
+											.appendTo(form)[0]);
 								}
 							}
 						}
@@ -725,7 +740,8 @@
 
 					return;
 
-				} else if (e === SERVER_ABORT && xhr) {
+				}
+				if (e === SERVER_ABORT && xhr) {
 					xhr.abort('server abort');
 					deferred.reject(xhr, 'error', 'server abort');
 
@@ -1000,6 +1016,10 @@
 			return this;
 		}
 
+		if (options.beforeFormUnbind) {
+			options.beforeFormUnbind(this, options);
+		}
+
 		return this.ajaxFormUnbind()
 			.on('submit.form-plugin', options, doAjaxSubmit)
 			.on('click.form-plugin', options, captureSubmittingElement);
@@ -1394,7 +1414,7 @@
 			switch (tag) {
 			case 'input':
 				this.checked = this.defaultChecked;
-					// fall through
+				// fall through
 
 			case 'textarea':
 				this.value = this.defaultValue;
@@ -1442,8 +1462,8 @@
 				return true;
 
 			case 'form':
-					// guard against an input with the name of 'reset'
-					// note that IE reports the reset function as an 'object'
+				// 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' && !this.reset.nodeType)) {
 					this.reset();
 				}