aboutsummaryrefslogtreecommitdiffstats
path: root/src/data
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-11-18 21:15:03 +0100
committerGitHub <noreply@github.com>2019-11-18 21:15:03 +0100
commitd0ce00cdfa680f1f0c38460bc51ea14079ae8b07 (patch)
tree8625b82760f0722443f3901f78d94025d7645463 /src/data
parenta612733be0c68d337647a6fcc8f8e0cabc1fc36b (diff)
downloadjquery-d0ce00cdfa680f1f0c38460bc51ea14079ae8b07.tar.gz
jquery-d0ce00cdfa680f1f0c38460bc51ea14079ae8b07.zip
Core: Migrate from AMD to ES modules 🎉
Migrate all source AMD modules to ECMAScript modules. The final bundle is compiled by a custom build process that uses Rollup under the hood. Test files themselves are still loaded via RequireJS as that has to work in IE 11. Tests can now be run in "Load as modules" mode which replaces the previous "Load with AMD" option. That option of running tests doesn't work in IE and Edge as it requires support for dynamic imports. Some of the changes required by the migration: * check `typeof` of `noGlobal` instead of using the variable directly as it's not available when modules are used * change the nonce module to be an object as ECMASscript module exports are immutable * remove some unused exports * import `./core/parseHTML.js` directly in `jquery.js` so that it's not being cut out when the `ajax` module is excluded in a custom compilation Closes gh-4541
Diffstat (limited to 'src/data')
-rw-r--r--src/data/Data.js15
-rw-r--r--src/data/var/acceptData.js8
-rw-r--r--src/data/var/dataPriv.js8
-rw-r--r--src/data/var/dataUser.js8
4 files changed, 10 insertions, 29 deletions
diff --git a/src/data/Data.js b/src/data/Data.js
index c94480fcd..556f4e39c 100644
--- a/src/data/Data.js
+++ b/src/data/Data.js
@@ -1,11 +1,7 @@
-define( [
- "../core",
- "../core/camelCase",
- "../var/rnothtmlwhite",
- "./var/acceptData"
-], function( jQuery, camelCase, rnothtmlwhite, acceptData ) {
-
-"use strict";
+import jQuery from "../core.js";
+import camelCase from "../core/camelCase.js";
+import rnothtmlwhite from "../var/rnothtmlwhite.js";
+import acceptData from "./var/acceptData.js";
function Data() {
this.expando = jQuery.expando + Data.uid++;
@@ -158,5 +154,4 @@ Data.prototype = {
}
};
-return Data;
-} );
+export default Data;
diff --git a/src/data/var/acceptData.js b/src/data/var/acceptData.js
index e00f7538b..4fc47b30a 100644
--- a/src/data/var/acceptData.js
+++ b/src/data/var/acceptData.js
@@ -1,11 +1,7 @@
-define( function() {
-
-"use strict";
-
/**
* Determines whether an object can have data
*/
-return function( owner ) {
+export default function( owner ) {
// Accepts only:
// - Node
@@ -15,5 +11,3 @@ return function( owner ) {
// - Any
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
-
-} );
diff --git a/src/data/var/dataPriv.js b/src/data/var/dataPriv.js
index 72713c88c..94ea1190e 100644
--- a/src/data/var/dataPriv.js
+++ b/src/data/var/dataPriv.js
@@ -1,7 +1,3 @@
-define( [
- "../Data"
-], function( Data ) {
- "use strict";
+import Data from "../Data.js";
- return new Data();
-} );
+export default new Data();
diff --git a/src/data/var/dataUser.js b/src/data/var/dataUser.js
index 72713c88c..94ea1190e 100644
--- a/src/data/var/dataUser.js
+++ b/src/data/var/dataUser.js
@@ -1,7 +1,3 @@
-define( [
- "../Data"
-], function( Data ) {
- "use strict";
+import Data from "../Data.js";
- return new Data();
-} );
+export default new Data();