Issue #3419734 by catch, nod_: [jQuery 4] jquery-form is unmaintained and not jQuery 4 compatible, fork it into core

merge-requests/6971/head
Dave Long 2024-03-08 12:50:56 +00:00
parent f8a2ccac36
commit a01b8c2ad5
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
10 changed files with 13 additions and 53 deletions

View File

@ -8,6 +8,7 @@
".*ignore",
"composer.lock",
"assets/vendor/**",
"misc/jquery.form.js",
"lib/Drupal/Component/Diff/**",
"lib/Drupal/Component/Transliteration/data/**",
"lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php",

View File

@ -16,3 +16,4 @@ modules/sdc/tests/themes/sdc_theme_test/components/bar/bar.component.yml
# Temporary until they are brought up to standards
scripts/**/*
modules/ckeditor5/webpack.config.js
misc/jquery.form.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -741,14 +741,13 @@ jquery:
internal.jquery.form:
# Internal library. Do not depend on it outside core nor add new core usage.
remote: https://github.com/jquery-form/form
version: "4.3.0"
license:
name: GNU-GPL-2.0-or-later
url: https://raw.githubusercontent.com/jquery-form/form/master/LICENSE
gpl-compatible: true
js:
assets/vendor/jquery-form/jquery.form.min.js: { minified: true }
misc/jquery.form.js: {}
dependencies:
- core/jquery

View File

@ -159,7 +159,7 @@
method = options.method || options.type || this.attr2('method');
action = options.url || this.attr2('action');
url = (typeof action === 'string') ? $.trim(action) : '';
url = (typeof action === 'string') ? action.trim() : '';
url = url || window.location.href || '';
if (url) {
// clean url (don't include hash vaue)
@ -206,7 +206,7 @@
var qx, a = this.formToArray(options.semantic, elements, options.filtering);
if (options.data) {
var optionsData = $.isFunction(options.data) ? options.data(a) : options.data;
var optionsData = typeof(options.data) === "function" ? options.data(a) : options.data;
options.extraData = optionsData;
qx = $.param(optionsData, traditional);
@ -268,8 +268,8 @@
});
} else if (options.success) {
if ($.isArray(options.success)) {
$.merge(callbacks, options.success);
if (Array.isArray(options.success)) {
callbacks = callbacks.concat(options.success);
} else {
callbacks.push(options.success);
}
@ -985,7 +985,7 @@
}
options = options || {};
options.delegation = options.delegation && $.isFunction($.fn.on);
options.delegation = options.delegation && typeof $.fn.on === 'function';
// in jQuery 1.3+ we can fix mistakes with the ready state
if (!options.delegation && this.length === 0) {
@ -1123,7 +1123,7 @@
return a;
}
if ($.isFunction(filtering)) {
if (typeof(filtering) === "function") {
els = $.map(els, filtering);
}
@ -1279,8 +1279,8 @@
continue;
}
if (v.constructor === Array) {
$.merge(val, v);
if (Array.isArray(v)) {
val = val.concat(v);
} else {
val.push(v);
}

View File

@ -72,7 +72,6 @@
"eslint-plugin-yml": "^1.8.0",
"glob": "10.3.5",
"jquery": "~3.7.0",
"jquery-form": "4.3.x",
"jquery-ui": "1.13.x",
"js-cookie": "^3.0.5",
"jsdom": "^23.0.0",

View File

@ -87,15 +87,6 @@ const assetsFolder = `${coreFolder}/assets/vendor`;
{ from: 'dist/jquery.min.map', to: 'jquery.min.map' },
],
},
{
pack: 'jquery-form',
library: 'internal.jquery.form',
files: [
{ from: 'dist/jquery.form.min.js', to: 'jquery.form.min.js' },
{ from: 'dist/jquery.form.min.js.map', to: 'jquery.form.min.js.map' },
{ from: 'src/jquery.form.js', to: 'src/jquery.form.js' },
],
},
{
pack: 'js-cookie',
files: [{ from: 'dist/js.cookie.min.js', to: 'js.cookie.min.js' }],

View File

@ -410,7 +410,7 @@ class AttachedAssetsTest extends KernelTestBase {
$js = $this->assetResolver->getJsAssets($assets, FALSE, \Drupal::languageManager()->getCurrentLanguage())[1];
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_js = (string) $this->renderer->renderInIsolation($js_render_array);
$this->assertStringContainsString('core/assets/vendor/jquery-form/jquery.form.min.js', (string) $rendered_js, 'Altered library dependencies are added to the page.');
$this->assertStringContainsString('core/misc/jquery.form.js', (string) $rendered_js, 'Altered library dependencies are added to the page.');
}
/**

View File

@ -3523,13 +3523,6 @@ jest-worker@^27.4.5:
merge-stream "^2.0.0"
supports-color "^8.0.0"
jquery-form@4.3.x:
version "4.3.0"
resolved "https://registry.yarnpkg.com/jquery-form/-/jquery-form-4.3.0.tgz#7d3961c314a1f2d15298f4af1d3943f54f4149c6"
integrity sha512-q3uaVCEWdLOYUCI6dpNdwf/7cJFOsUgdpq6r0taxtGQ5NJSkOzofyWm4jpOuJ5YxdmL1FI5QR+q+HB63HHLGnQ==
dependencies:
jquery ">=1.7.2"
jquery-ui@1.13.x:
version "1.13.2"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.13.2.tgz#de03580ae6604773602f8d786ad1abfb75232034"
@ -3537,7 +3530,7 @@ jquery-ui@1.13.x:
dependencies:
jquery ">=1.8.0 <4.0.0"
jquery@>=1.7.2, "jquery@>=1.8.0 <4.0.0", jquery@~3.7.0:
"jquery@>=1.8.0 <4.0.0", jquery@~3.7.0:
version "3.7.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==