Skip to content

Commit a4dd6b1

Browse files
committed
chore(jquery-form): disable AMD loading for compatibility with DXP
In our previous fork of this module, we have an `if (false)` condition to prevent the module from calling `define`: https://github.com/liferay/liferay-portal/blob/19d993d6e3c0dd6865924bf23f75992f52fc355e/modules/apps/frontend-js/frontend-js-jquery-web/src/main/resources/META-INF/resources/jquery/form.js#L33 That's pretty ugly, and just stripping out the conditional is a still a pretty minimal edit, so let's go with that instead. Note that if you look at the DXP version, we wrap the entire function in a wrapper that just passes in `window.$` as `jQuery`, but that changes the indentation level of the entire file, so to make a minimal edit here we don't do that. After this change, we're basically identical to what is in DXP (compared that by source-formatting the file, overwriting it with the DXP copy, and inspecting the changes with `git diff -w`).
1 parent 880ea16 commit a4dd6b1

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

third-party/projects/jquery-form/jquery.form.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@
1010
*/
1111
/*global ActiveXObject */
1212

13-
// AMD support
1413
(function (factory) {
1514
"use strict";
16-
if (typeof define === 'function' && define.amd) {
17-
// using AMD; register as anon module
18-
define(['jquery'], factory);
19-
} else {
20-
// no AMD; invoke directly
21-
factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
22-
}
15+
factory(window.$ || window.Zepto);
2316
}
2417

2518
(function($) {

0 commit comments

Comments
 (0)