]> source.dussan.org Git - jquery.git/commitdiff
Core: Migrate from AMD to ES modules 🎉
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 18 Nov 2019 20:15:03 +0000 (21:15 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Nov 2019 20:15:03 +0000 (21:15 +0100)
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

124 files changed:
.eslintrc-browser.json
.eslintrc-node.json
.eslintrc.json
CONTRIBUTING.md
Gruntfile.js
build/tasks/build.js
dist/.eslintrc.json
package.json
src/.eslintrc.json
src/ajax.js
src/ajax/jsonp.js
src/ajax/load.js
src/ajax/parseXML.js
src/ajax/script.js
src/ajax/var/location.js
src/ajax/var/nonce.js
src/ajax/var/rquery.js
src/ajax/xhr.js
src/attributes.js
src/attributes/attr.js
src/attributes/classes.js
src/attributes/prop.js
src/attributes/val.js
src/callbacks.js
src/core.js
src/core/DOMEval.js
src/core/access.js
src/core/camelCase.js
src/core/init.js
src/core/isAttached.js
src/core/nodeName.js
src/core/parseHTML.js
src/core/ready-no-deferred.js
src/core/ready.js
src/core/readyException.js
src/core/stripAndCollapse.js
src/core/toType.js
src/core/var/rhtml.js
src/core/var/rsingleTag.js
src/css.js
src/css/adjustCSS.js
src/css/cssCamelCase.js
src/css/curCSS.js
src/css/finalPropName.js
src/css/hiddenVisibleSelectors.js
src/css/isAutoPx.js
src/css/showHide.js
src/css/support.js
src/css/var/cssExpand.js
src/css/var/getStyles.js
src/css/var/isHiddenWithinTree.js
src/css/var/rnumnonpx.js
src/css/var/swap.js
src/data.js
src/data/Data.js
src/data/var/acceptData.js
src/data/var/dataPriv.js
src/data/var/dataUser.js
src/deferred.js
src/deferred/exceptionHook.js
src/deprecated.js
src/dimensions.js
src/effects.js
src/effects/Tween.js
src/effects/animatedSelector.js
src/event.js
src/event/ajax.js
src/event/alias.js
src/event/trigger.js
src/exports/amd.js
src/exports/global.js
src/jquery.js
src/manipulation.js
src/manipulation/_evalUrl.js
src/manipulation/buildFragment.js
src/manipulation/getAll.js
src/manipulation/setGlobalEval.js
src/manipulation/var/rscriptType.js
src/manipulation/var/rtagName.js
src/manipulation/wrapMap.js
src/offset.js
src/queue.js
src/queue/delay.js
src/selector.js
src/selector/contains.js
src/selector/escapeSelector.js
src/selector/rbuggyQSA.js
src/selector/support.js
src/selector/uniqueSort.js
src/serialize.js
src/traversing.js
src/traversing/findFilter.js
src/traversing/var/dir.js
src/traversing/var/rneedsContext.js
src/traversing/var/siblings.js
src/var/ObjectFunctionString.js
src/var/arr.js
src/var/class2type.js
src/var/document.js
src/var/documentElement.js
src/var/flat.js
src/var/fnToString.js
src/var/getProto.js
src/var/hasOwn.js
src/var/indexOf.js
src/var/isIE.js
src/var/isWindow.js
src/var/pnum.js
src/var/pop.js
src/var/push.js
src/var/rcheckableType.js
src/var/rcssNum.js
src/var/rnothtmlwhite.js
src/var/slice.js
src/var/sort.js
src/var/support.js
src/var/toString.js
src/var/trim.js
src/wrap.js
src/wrapper.js
test/.eslintrc.json
test/data/testinit.js
test/index.html
test/jquery.js

index 146745d0ec2a40e41e393bf3c8c13cfa2c3fdfab..127fc6ce88480555c48dda851f81525dc455396e 100644 (file)
@@ -15,9 +15,7 @@
        "env": {},
 
        "globals": {
-               "window": true,
-               "define": true,
-               "module": true
+               "window": true
        },
 
        "rules": {
index 544a92cdc8a9cd2c3a141e8c0167b48f8dad7d2a..f1c44a3829f54daea087ee1ed8ab9365e24e40be 100644 (file)
@@ -4,7 +4,7 @@
        "extends": "jquery",
 
        "parserOptions": {
-               "ecmaVersion": 2017
+               "ecmaVersion": 2018
        },
 
        "env": {
index d2c977ca851d8ba124539a86f9a140e55318f87a..2fad01637db13327ae5431fcb475cd869f11a9e9 100644 (file)
@@ -1,5 +1,14 @@
 {
        "root": true,
 
-       "extends": "./.eslintrc-node.json"
+       "extends": "./.eslintrc-node.json",
+
+       "overrides": [
+               {
+                       "files": "rollup.config.js",
+                       "parserOptions": {
+                               "sourceType": "module"
+                       }
+               }
+       ]
 }
index 18c6bc80250ddff3e0dec5aa1039cd36a219c046..2deb7d1803a0edd96e617c8ff1765775988e3ff5 100644 (file)
@@ -129,14 +129,14 @@ Rather than rebuilding jQuery with `grunt` every time you make a change, you can
 $ grunt watch
 ```
 
-Alternatively, you can **load tests in AMD** to avoid the need for rebuilding altogether.
+Alternatively, you can **load tests as ECMAScript modules** to avoid the need for rebuilding altogether.
 
-Click "Load with AMD" after loading the test page.
+Click "Load as modules" after loading the test page.
 
 
 ### Repo organization
 
-The jQuery source is organized with AMD modules and then concatenated and compiled at build time.
+The jQuery source is organized with ECMAScript modules and then compiled into one file at build time.
 
 jQuery also contains some special modules we call "var modules", which are placed in folders named "var". At build time, these small modules are compiled to simple var statements. This makes it easy for us to share variables across modules. Browse the "src" folder for examples.
 
index 831ca4b8865566242e44579bec5f7987df30576a..9ed250a3ea607553c8f1d414673340f36639a6b6 100644 (file)
@@ -177,7 +177,7 @@ module.exports = function( grunt ) {
                                        "test/unit/ready.js",
 
                                        { pattern: "dist/jquery.*", included: false, served: true },
-                                       { pattern: "src/**", included: false, served: true },
+                                       { pattern: "src/**", type: "module", included: false, served: true },
                                        { pattern: "node_modules/**", included: false, served: true },
                                        {
                                                pattern: "test/**/*.@(js|css|jpg|html|xml|svg)",
index 63dfc1ee867d76996f410043f3dcdf6d42e82750..188e1e4524d5e90f491cf7f43f27e944f048c05a 100644 (file)
 /**
- * Special concat/build task to handle various jQuery build requirements
- * Concats AMD modules, removes their definitions,
+ * Special build task to handle various jQuery build requirements.
+ * Compiles JS modules into one bundle, sets the custom AMD name,
  * and includes/excludes specified modules
  */
 
 "use strict";
 
 module.exports = function( grunt ) {
-       var fs = require( "fs" ),
-               requirejs = require( "requirejs" ),
-               Insight = require( "insight" ),
-               pkg = require( "../../package.json" ),
-               srcFolder = __dirname + "/../../src/",
-               rdefineEnd = /\}\s*?\);[^}\w]*$/,
-               read = function( fileName ) {
-                       return grunt.file.read( srcFolder + fileName );
-               },
-
-               // Catch `// @CODE` and subsequent comment lines event if they don't start
-               // in the first column.
-               wrapper = read( "wrapper.js" ).split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ ),
-
-               config = {
-                       baseUrl: "src",
-                       name: "jquery",
-
-                       // Allow strict mode
-                       useStrict: true,
-
-                       // We have multiple minify steps
-                       optimize: "none",
-
-                       // Include dependencies loaded with require
-                       findNestedDependencies: true,
-
-                       // Avoid inserting define() placeholder
-                       skipModuleInsertion: true,
-
-                       // Avoid breaking semicolons inserted by r.js
-                       skipSemiColonInsertion: true,
-                       wrap: {
-                               start: wrapper[ 0 ].replace( /\/\*\s*eslint(?: |-).*\s*\*\/\n/, "" ),
-                               end: wrapper[ 1 ]
-                       },
-                       rawText: {},
-                       onBuildWrite: convert
-               };
-
-       /**
-        * Strip all definitions generated by requirejs
-        * Convert "var" modules to var declarations
-        * "var module" means the module only contains a return
-        * statement that should be converted to a var declaration
-        * This is indicated by including the file in any "var" folder
-        * @param {String} name
-        * @param {String} path
-        * @param {String} contents The contents to be written (including their AMD wrappers)
-        */
-       function convert( name, path, contents ) {
-               var amdName;
-
-               // Convert var modules
-               if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) {
-                       contents = contents
-                               .replace(
-                                       /define\(\s*(["'])[\w\W]*?\1[\w\W]*?return/,
-                                       "var " +
-                                       ( /var\/([\w-]+)/.exec( name )[ 1 ] ) +
-                                       " ="
-                               )
-                               .replace( rdefineEnd, "" );
-
-               } else {
-
-                       contents = contents
-                               .replace( /\s*return\s+[^\}]+(\}\s*?\);[^\w\}]*)$/, "$1" )
-
-                               // Multiple exports
-                               .replace( /\s*exports\.\w+\s*=\s*\w+;/g, "" );
-
-                       // Remove define wrappers, closure ends, and empty declarations
-                       contents = contents
-                               .replace( /define\([^{]*?{\s*(?:("|')use strict\1(?:;|))?/, "" )
-                               .replace( rdefineEnd, "" );
-
-                       // Remove anything wrapped with
-                       // /* ExcludeStart */ /* ExcludeEnd */
-                       // or a single line directly after a // BuildExclude comment
-                       contents = contents
-                               .replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, "" )
-                               .replace( /\/\/\s*BuildExclude\n\r?[\w\W]*?\n\r?/ig, "" );
-
-                       // Remove empty definitions
-                       contents = contents
-                               .replace( /define\(\[[^\]]*\]\)[\W\n]+$/, "" );
-               }
-
-               // AMD Name
-               if ( ( amdName = grunt.option( "amd" ) ) != null && /^exports\/amd$/.test( name ) ) {
-                       if ( amdName ) {
-                               grunt.log.writeln( "Naming jQuery with AMD name: " + amdName );
-                       } else {
-                               grunt.log.writeln( "AMD name now anonymous" );
-                       }
-
-                       // Remove the comma for anonymous defines
-                       contents = contents
-                               .replace( /(\s*)"jquery"(\,\s*)/, amdName ? "$1\"" + amdName + "\"$2" : "" );
-
-               }
-               return contents;
-       }
+       const fs = require( "fs" );
+       const path = require( "path" );
+       const rollup = require( "rollup" );
+       const rollupHypothetical = require( "rollup-plugin-hypothetical" );
+       const Insight = require( "insight" );
+       const pkg = require( "../../package.json" );
+       const srcFolder = path.resolve( `${ __dirname }/../../src` );
+       const read = function( fileName ) {
+               return grunt.file.read( `${ srcFolder }/${ fileName }` );
+       };
+
+       // Catch `// @CODE` and subsequent comment lines event if they don't start
+       // in the first column.
+       const wrapper = read( "wrapper.js" )
+               .split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ );
+
+       const inputFileName = "jquery.js";
+       const inputRollupOptions = {
+               input: `${ srcFolder }/${ inputFileName }`
+       };
+       const outputRollupOptions = {
+
+               // The ESM format is not actually used as we strip it during
+               // the build; it's just that it doesn't generate any extra
+               // wrappers so there's nothing for us to remove.
+               format: "esm",
+
+               intro: wrapper[ 0 ]
+                       .replace( /\n*$/, "" ),
+               outro: wrapper[ 1 ]
+                       .replace( /^\n*/, "" )
+       };
+       const rollupHypotheticalOptions = {
+               allowFallthrough: true,
+               files: {}
+       };
 
        grunt.registerMultiTask(
                "build",
                "Concatenate source, remove sub AMD definitions, " +
                        "(include/exclude modules with +/- flags), embed date/version",
-       function() {
-               var flag, index,
-                       done = this.async(),
-                       flags = this.flags,
-                       optIn = flags[ "*" ],
-                       name = grunt.option( "filename" ),
-                       minimum = this.data.minimum,
-                       removeWith = this.data.removeWith,
-                       excluded = [],
-                       included = [],
-                       version = grunt.config( "pkg.version" ),
+       async function() {
+               const done = this.async();
+
+               try {
+                       let flag, index;
+                       const flags = this.flags;
+                       const optIn = flags[ "*" ];
+                       let name = grunt.option( "filename" );
+                       const minimum = this.data.minimum;
+                       const removeWith = this.data.removeWith;
+                       const excluded = [];
+                       const included = [];
+                       let version = grunt.config( "pkg.version" );
 
                        /**
                         * Recursively calls the excluder to remove on all modules in the list
@@ -134,15 +68,16 @@ module.exports = function( grunt ) {
                         * @param {String} [prepend] Prepend this to the module name.
                         *  Indicates we're walking a directory
                         */
-                       excludeList = function( list, prepend ) {
+                       const excludeList = ( list, prepend ) => {
                                if ( list ) {
-                                       prepend = prepend ? prepend + "/" : "";
+                                       prepend = prepend ? `${ prepend }/` : "";
                                        list.forEach( function( module ) {
 
                                                // Exclude var modules as well
                                                if ( module === "var" ) {
                                                        excludeList(
-                                                               fs.readdirSync( srcFolder + prepend + module ), prepend + module
+                                                               fs.readdirSync( `${ srcFolder }/${ prepend }${ module }` ),
+                                                               prepend + module
                                                        );
                                                        return;
                                                }
@@ -164,7 +99,7 @@ module.exports = function( grunt ) {
                                                }
                                        } );
                                }
-                       },
+                       };
 
                        /**
                         * Adds the specified module to the excluded or included list, depending on the flag
@@ -172,11 +107,11 @@ module.exports = function( grunt ) {
                         *  the src directory starting with + or - to indicate
                         *  whether it should included or excluded
                         */
-                       excluder = function( flag ) {
-                               var additional,
-                                       m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ),
-                                       exclude = m[ 1 ] === "-",
-                                       module = m[ 2 ];
+                       const excluder = flag => {
+                               let additional;
+                               const m = /^(\+|\-|)([\w\/-]+)$/.exec( flag );
+                               const exclude = m[ 1 ] === "-";
+                               const module = m[ 2 ];
 
                                if ( exclude ) {
 
@@ -192,7 +127,10 @@ module.exports = function( grunt ) {
                                                        // These are the removable dependencies
                                                        // It's fine if the directory is not there
                                                        try {
-                                                               excludeList( fs.readdirSync( srcFolder + module ), module );
+                                                               excludeList(
+                                                                       fs.readdirSync( `${ srcFolder }/${ module }` ),
+                                                                       module
+                                                               );
                                                        } catch ( e ) {
                                                                grunt.verbose.writeln( e );
                                                        }
@@ -204,7 +142,7 @@ module.exports = function( grunt ) {
                                                if ( additional ) {
                                                        excludeList( additional.remove || additional );
                                                        if ( additional.include ) {
-                                                               included = included.concat( additional.include );
+                                                               included.push( ...additional.include );
                                                                grunt.log.writeln( "+" + additional.include );
                                                        }
                                                }
@@ -217,93 +155,122 @@ module.exports = function( grunt ) {
                                }
                        };
 
-               // Filename can be passed to the command line using
-               // command line options
-               // e.g. grunt build --filename=jquery-custom.js
-               name = name ? ( "dist/" + name ) : this.data.dest;
+                       // Filename can be passed to the command line using
+                       // command line options
+                       // e.g. grunt build --filename=jquery-custom.js
+                       name = name ? `dist/${ name }` : this.data.dest;
 
-               // append commit id to version
-               if ( process.env.COMMIT ) {
-                       version += " " + process.env.COMMIT;
-               }
+                       // append commit id to version
+                       if ( process.env.COMMIT ) {
+                               version += " " + process.env.COMMIT;
+                       }
 
-               // figure out which files to exclude based on these rules in this order:
-               //  dependency explicit exclude
-               //  > explicit exclude
-               //  > explicit include
-               //  > dependency implicit exclude
-               //  > implicit exclude
-               // examples:
-               //  *                  none (implicit exclude)
-               //  *:*                all (implicit include)
-               //  *:*:-css           all except css and dependents (explicit > implicit)
-               //  *:*:-css:+effects  same (excludes effects because explicit include is
-               //                     trumped by explicit exclude of dependency)
-               //  *:+effects         none except effects and its dependencies
-               //                     (explicit include trumps implicit exclude of dependency)
-               delete flags[ "*" ];
-               for ( flag in flags ) {
-                       excluder( flag );
-               }
+                       // figure out which files to exclude based on these rules in this order:
+                       //  dependency explicit exclude
+                       //  > explicit exclude
+                       //  > explicit include
+                       //  > dependency implicit exclude
+                       //  > implicit exclude
+                       // examples:
+                       //  *                  none (implicit exclude)
+                       //  *:*                all (implicit include)
+                       //  *:*:-css           all except css and dependents (explicit > implicit)
+                       //  *:*:-css:+effects  same (excludes effects because explicit include is
+                       //                     trumped by explicit exclude of dependency)
+                       //  *:+effects         none except effects and its dependencies
+                       //                     (explicit include trumps implicit exclude of dependency)
+                       delete flags[ "*" ];
+                       for ( flag in flags ) {
+                               excluder( flag );
+                       }
 
-               // Replace exports/global with a noop noConflict
-               if ( ( index = excluded.indexOf( "exports/global" ) ) > -1 ) {
-                       config.rawText[ "exports/global" ] = "define(['../core']," +
-                               "function( jQuery ) {\njQuery.noConflict = function() {};\n});";
-                       excluded.splice( index, 1 );
-               }
+                       // Remove the jQuery export from the entry file, we'll use our own
+                       // custom wrapper.
+                       rollupHypotheticalOptions.files[ inputRollupOptions.input ] = read( inputFileName )
+                               .replace( /\n*export default jQuery;\n*/, "\n" );
+
+                       // Replace exports/global with a noop noConflict
+                       if ( ( index = excluded.indexOf( "exports/global" ) ) > -1 ) {
+                               rollupHypotheticalOptions.files[ `${ srcFolder }/exports/global.js` ] =
+                                       "import jQuery from \"../core.js\";\n\n" +
+                                       "jQuery.noConflict = function() {};";
+                               excluded.splice( index, 1 );
+                       }
 
-               grunt.verbose.writeflags( excluded, "Excluded" );
-               grunt.verbose.writeflags( included, "Included" );
+                       // Set a desired AMD name.
+                       let amdName = grunt.option( "amd" );
+                       if ( amdName != null ) {
+                               if ( amdName ) {
+                                       grunt.log.writeln( "Naming jQuery with AMD name: " + amdName );
+                               } else {
+                                       grunt.log.writeln( "AMD name now anonymous" );
+                               }
 
-               // append excluded modules to version
-               if ( excluded.length ) {
-                       version += " -" + excluded.join( ",-" );
+                               // Remove the comma for anonymous defines
+                               rollupHypotheticalOptions.files[ `${ srcFolder }/exports/amd.js` ] =
+                                       read( "exports/amd.js" )
+                                               .replace( /(\s*)"jquery"(\,\s*)/, amdName ? "$1\"" + amdName + "\"$2" : "" );
+                       }
 
-                       // set pkg.version to version with excludes, so minified file picks it up
-                       grunt.config.set( "pkg.version", version );
-                       grunt.verbose.writeln( "Version changed to " + version );
+                       grunt.verbose.writeflags( excluded, "Excluded" );
+                       grunt.verbose.writeflags( included, "Included" );
 
-                       // Have to use shallow or core will get excluded since it is a dependency
-                       config.excludeShallow = excluded;
-               }
-               config.include = included;
+                       // append excluded modules to version
+                       if ( excluded.length ) {
+                               version += " -" + excluded.join( ",-" );
+
+                               // set pkg.version to version with excludes, so minified file picks it up
+                               grunt.config.set( "pkg.version", version );
+                               grunt.verbose.writeln( "Version changed to " + version );
+
+                               // Replace excluded modules with empty sources.
+                               for ( const module of excluded ) {
+                                       rollupHypotheticalOptions.files[ `${ srcFolder }/${ module }.js` ] = "";
+                               }
+                       }
+
+                       // Turn off opt-in if necessary
+                       if ( !optIn ) {
 
-               /**
-                * Handle Final output from the optimizer
-                * @param {String} compiled
-                */
-               config.out = function( compiled ) {
-                       compiled = compiled
+                               // Remove the default inclusions, they will be overwritten with the explicitly
+                               // included ones.
+                               rollupHypotheticalOptions.files[ inputRollupOptions.input ] = "";
+
+                       }
+
+                       // Import the explicitly included modules.
+                       if ( included.length ) {
+                               rollupHypotheticalOptions.files[ inputRollupOptions.input ] += included
+                                       .map( module => `import "./${module}.js";` )
+                                       .join( "\n" );
+                       }
+
+                       const bundle = await rollup.rollup( {
+                               ...inputRollupOptions,
+                               plugins: [ rollupHypothetical( rollupHypotheticalOptions ) ]
+                       } );
+
+                       const { output: [ { code } ] } = await bundle.generate( outputRollupOptions );
+
+                       const compiledContents = code
 
                                // Embed Version
                                .replace( /@VERSION/g, version )
 
                                // Embed Date
                                // yyyy-mm-ddThh:mmZ
-                               .replace( /@DATE/g, ( new Date() ).toISOString().replace( /:\d+\.\d+Z$/, "Z" ) );
-
-                       // Write concatenated source to file
-                       grunt.file.write( name, compiled );
-               };
-
-               // Turn off opt-in if necessary
-               if ( !optIn ) {
-
-                       // Overwrite the default inclusions with the explicit ones provided
-                       config.rawText.jquery = "define([" +
-                               ( included.length ? included.join( "," ) : "" ) +
-                       "]);";
-               }
+                               .replace(
+                                       /@DATE/g,
+                                       ( new Date() ).toISOString()
+                                               .replace( /:\d+\.\d+Z$/, "Z" )
+                               );
 
-               // Trace dependencies and concatenate files
-               requirejs.optimize( config, function( response ) {
-                       grunt.verbose.writeln( response );
+                       grunt.file.write( name, compiledContents );
                        grunt.log.ok( "File '" + name + "' created." );
                        done();
-               }, function( err ) {
+               } catch ( err ) {
                        done( err );
-               } );
+               }
        } );
 
        // Special "alias" task to make custom build creation less grawlix-y
@@ -315,17 +282,17 @@ module.exports = function( grunt ) {
        //
        //   grunt build:*:*:+ajax:-dimensions:-effects:-offset
        grunt.registerTask( "custom", function() {
-               var args = this.args,
-                       modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : "",
-                       done = this.async(),
-                       insight = new Insight( {
-                               trackingCode: "UA-1076265-4",
-                               pkg: pkg
-                       } );
+               const args = this.args;
+               const modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : "";
+               const done = this.async();
+               const insight = new Insight( {
+                       trackingCode: "UA-1076265-4",
+                       pkg: pkg
+               } );
 
                function exec( trackingAllowed ) {
-                       var tracks = args.length ? args[ 0 ].split( "," ) : [];
-                       var defaultPath = [ "build", "custom" ];
+                       let tracks = args.length ? args[ 0 ].split( "," ) : [];
+                       const defaultPath = [ "build", "custom" ];
 
                        tracks = tracks.map( function( track ) {
                                return track.replace( /\//g, "+" );
@@ -335,7 +302,7 @@ module.exports = function( grunt ) {
 
                                // Track individuals
                                tracks.forEach( function( module ) {
-                                       var path = defaultPath.concat( [ "individual" ], module );
+                                       const path = defaultPath.concat( [ "individual" ], module );
 
                                        insight.track.apply( insight, path );
                                } );
index 6108d16197c9bb01daa57b27ad00329b378a631b..bf60c4c18e7276fbeedf1847260bfb077d63e94d 100644 (file)
@@ -3,8 +3,19 @@
 
        "extends": "../.eslintrc-browser.json",
 
+       "parserOptions": {
+               "ecmaVersion": 5,
+               "sourceType": "script"
+       },
+
        "rules": {
                // That is okay for the built version
                "no-multiple-empty-lines": "off"
+       },
+
+       "globals": {
+               "define": false,
+               "module": true,
+               "Symbol": false
        }
 }
index 99ddba79e3b90f072ee09104df22f9e151696898..106417d072091c9e461130dbc79e3dc5268925d9 100644 (file)
@@ -36,7 +36,7 @@
     "grunt-compare-size": "0.4.2",
     "grunt-contrib-uglify": "3.4.0",
     "grunt-contrib-watch": "1.1.0",
-    "grunt-eslint": "21.0.0",
+    "grunt-eslint": "22.0.0",
     "grunt-git-authors": "3.2.0",
     "grunt-jsonlint": "1.1.0",
     "grunt-karma": "3.0.1",
@@ -59,6 +59,8 @@
     "qunit": "2.9.2",
     "raw-body": "2.3.3",
     "requirejs": "2.3.6",
+    "rollup": "1.25.2",
+    "rollup-plugin-hypothetical": "2.1.0",
     "sinon": "7.3.1",
     "strip-json-comments": "2.0.1",
     "testswarm": "1.1.0",
index 3d0ca185a21bae7e8538785643670bc3e101b061..44cb3a179550172786586d8d4aab6b23d0ca5274 100644 (file)
@@ -3,11 +3,42 @@
 
        "extends": "../.eslintrc-browser.json",
 
+       "parserOptions": {
+               "ecmaVersion": 2015,
+               "sourceType": "module"
+       },
+
        "overrides": [
                {
                        "files": "wrapper.js",
+                       "parserOptions": {
+                               "ecmaVersion": 5,
+                               "sourceType": "script"
+                       },
+                       "rules": {
+                               "no-unused-vars": "off"
+                       },
+                       "globals": {
+                               "jQuery": false,
+                               "module": true
+                       }
+               },
+
+               {
+                       "files": "exports/amd.js",
                        "globals": {
-                               "jQuery": false
+                               "define": false
+                       }
+               },
+
+               {
+                       "files": "core.js",
+                       "globals": {
+
+                               // Defining Symbol globally would create a danger of using
+                               // it unguarded in another place, it seems safer to define
+                               // it only for this module.
+                               "Symbol": false
                        }
                }
        ]
index 53557253f44521d4d195a0c99a0e3597b938987a..51bcf8a0e719f0c1231629ccddd0dae12b3ece53 100644 (file)
@@ -1,19 +1,15 @@
-define( [
-       "./core",
-       "./var/document",
-       "./var/rnothtmlwhite",
-       "./ajax/var/location",
-       "./ajax/var/nonce",
-       "./ajax/var/rquery",
-
-       "./core/init",
-       "./ajax/parseXML",
-       "./event/trigger",
-       "./deferred",
-       "./serialize" // jQuery.param
-], function( jQuery, document, rnothtmlwhite, location, nonce, rquery ) {
-
-"use strict";
+import jQuery from "./core.js";
+import document from "./var/document.js";
+import rnothtmlwhite from "./var/rnothtmlwhite.js";
+import location from "./ajax/var/location.js";
+import nonce from "./ajax/var/nonce.js";
+import rquery from "./ajax/var/rquery.js";
+
+import "./core/init.js";
+import "./ajax/parseXML.js";
+import "./event/trigger.js";
+import "./deferred.js";
+import "./serialize"; // jQuery.param
 
 var
        r20 = /%20/g,
@@ -615,7 +611,8 @@ jQuery.extend( {
                        // Add or update anti-cache param if needed
                        if ( s.cache === false ) {
                                cacheURL = cacheURL.replace( rantiCache, "$1" );
-                               uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
+                               uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" +
+                                       ( nonce.guid++ ) + uncached;
                        }
 
                        // Put hash and anti-cache on the URL that will be requested (gh-1732)
@@ -864,5 +861,4 @@ jQuery.each( [ "get", "post" ], function( _i, method ) {
        };
 } );
 
-return jQuery;
-} );
+export default jQuery;
index dbdb4dbb87061d05b93fcd3ec802710664746139..1d612c1a976c4a846699de011fa727226b407daf 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "../core",
-       "./var/nonce",
-       "./var/rquery",
-       "../ajax"
-], function( jQuery, nonce, rquery ) {
+import jQuery from "../core.js";
+import nonce from "./var/nonce.js";
+import rquery from "./var/rquery.js";
 
-"use strict";
+import "../ajax.js";
 
 var oldCallbacks = [],
        rjsonp = /(=)\?(?=&|$)|\?\?/;
@@ -14,7 +11,7 @@ var oldCallbacks = [],
 jQuery.ajaxSetup( {
        jsonp: "callback",
        jsonpCallback: function() {
-               var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
+               var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
                this[ callback ] = true;
                return callback;
        }
@@ -98,5 +95,3 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
                return "script";
        }
 } );
-
-} );
index 574d6b4a7331777c581eb98c8213906e7e30f300..9a91b990b7f757147352972238fb955f6b416062 100644 (file)
@@ -1,14 +1,11 @@
-define( [
-       "../core",
-       "../core/stripAndCollapse",
-       "../core/parseHTML",
-       "../ajax",
-       "../traversing",
-       "../manipulation",
-       "../selector"
-], function( jQuery, stripAndCollapse ) {
+import jQuery from "../core.js";
+import stripAndCollapse from "../core/stripAndCollapse.js";
 
-"use strict";
+import "../core/parseHTML.js";
+import "../ajax.js";
+import "../traversing.js";
+import "../manipulation.js";
+import "../selector.js";
 
 /**
  * Load a url into a page
@@ -72,5 +69,3 @@ jQuery.fn.load = function( url, params, callback ) {
 
        return this;
 };
-
-} );
index 0bdc49a7ca0c0a6e95b5cbdeacb7bdf25083bd6f..d547eab5308d06e1df7bc6d99ed906edf1a5a32e 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 // Cross-browser xml parsing
 jQuery.parseXML = function( data ) {
@@ -25,6 +21,4 @@ jQuery.parseXML = function( data ) {
        return xml;
 };
 
-return jQuery.parseXML;
-
-} );
+export default jQuery.parseXML;
index 410c82cab57bf50e5ee57118f29684d8de1c6bf5..22dc291835a69e1e72099168971ab3e9322561de 100644 (file)
@@ -1,10 +1,7 @@
-define( [
-       "../core",
-       "../var/document",
-       "../ajax"
-], function( jQuery, document ) {
+import jQuery from "../core.js";
+import document from "../var/document.js";
 
-"use strict";
+import "../ajax.js";
 
 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
 jQuery.ajaxPrefilter( function( s ) {
@@ -70,5 +67,3 @@ jQuery.ajaxTransport( "script", function( s ) {
                };
        }
 } );
-
-} );
index 4171d18c366eaec112f75c1b3865fed7b6fb8e49..78e6f07b338c2d787b0a46eee08e6941b284c24b 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return window.location;
-} );
+export default window.location;
index 33d0cffb67f821ef5eb2c52813f07c2dcb916f79..b0070c699fa8d5439ae8f0997e4175e0f23c3099 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return Date.now();
-} );
+export default { guid: Date.now() };
index 06fc37439caa95ed9bb20bbc9ee3bdb1145e02fb..f18f8766197aab2d493ad227973d1b97d2385215 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return ( /\?/ );
-} );
+export default ( /\?/ );
index 3578ba1679d728dd6a3992f2d4b8aed0337a0b2d..f6bd52337fc6edf96e799904f6fab4177b39fa98 100644 (file)
@@ -1,9 +1,6 @@
-define( [
-       "../core",
-       "../ajax"
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../ajax.js";
 
 jQuery.ajaxSettings.xhr = function() {
        return new window.XMLHttpRequest();
@@ -116,5 +113,3 @@ jQuery.ajaxTransport( function( options ) {
                }
        };
 } );
-
-} );
index 2d801e56398a91bcedd6c51f59f67445a3e8b455..646107adcc1b5a73575112a997680d491f3173c4 100644 (file)
@@ -1,13 +1,9 @@
-define( [
-       "./core",
-       "./attributes/attr",
-       "./attributes/prop",
-       "./attributes/classes",
-       "./attributes/val"
-], function( jQuery ) {
+import jQuery from "./core.js";
 
-"use strict";
+import "./attributes/attr.js";
+import "./attributes/prop.js";
+import "./attributes/classes.js";
+import "./attributes/val.js";
 
 // Return jQuery for attributes-only inclusion
-return jQuery;
-} );
+export default jQuery;
index afa4f5775a32381e568b68c431e8684e11994864..cd34860e1fa85b872678035fcdfb57217544bf32 100644 (file)
@@ -1,13 +1,10 @@
-define( [
-       "../core",
-       "../core/access",
-       "../core/nodeName",
-       "../var/rnothtmlwhite",
-       "../var/isIE",
-       "../selector"
-], function( jQuery, access, nodeName, rnothtmlwhite, isIE ) {
+import jQuery from "../core.js";
+import access from "../core/access.js";
+import nodeName from "../core/nodeName.js";
+import rnothtmlwhite from "../var/rnothtmlwhite.js";
+import isIE from "../var/isIE.js";
 
-"use strict";
+import "../selector.js";
 
 jQuery.fn.extend( {
        attr: function( name, value ) {
@@ -128,5 +125,3 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name )
                }
        };
 } );
-
-} );
index f1571eb5d0685c8cea8a394d90c61f3d9b5a8f82..e020aa5cfc0cf1d00941548b206869d8c260992a 100644 (file)
@@ -1,12 +1,9 @@
-define( [
-       "../core",
-       "../core/stripAndCollapse",
-       "../var/rnothtmlwhite",
-       "../data/var/dataPriv",
-       "../core/init"
-], function( jQuery, stripAndCollapse, rnothtmlwhite, dataPriv ) {
+import jQuery from "../core.js";
+import stripAndCollapse from "../core/stripAndCollapse.js";
+import rnothtmlwhite from "../var/rnothtmlwhite.js";
+import dataPriv from "../data/var/dataPriv.js";
 
-"use strict";
+import "../core/init.js";
 
 function getClass( elem ) {
        return elem.getAttribute && elem.getAttribute( "class" ) || "";
@@ -181,5 +178,3 @@ jQuery.fn.extend( {
                return false;
        }
 } );
-
-} );
index 651d9e215c4d107d46aa21ed115ee1089ff38c58..d58adf3697d5717282f015895cbe769ccdd055bf 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "../core",
-       "../core/access",
-       "../var/isIE",
-       "../selector"
-], function( jQuery, access, isIE ) {
+import jQuery from "../core.js";
+import access from "../core/access.js";
+import isIE from "../var/isIE.js";
 
-"use strict";
+import "../selector.js";
 
 var rfocusable = /^(?:input|select|textarea|button)$/i,
        rclickable = /^(?:a|area)$/i;
@@ -136,5 +133,3 @@ jQuery.each( [
 ], function() {
        jQuery.propFix[ this.toLowerCase() ] = this;
 } );
-
-} );
index 02559ffaa458f8eca05bced1150719ad05339c28..38e170ba8ae0dc1a6eb94ed784b8dde7243a8b59 100644 (file)
@@ -1,12 +1,8 @@
-define( [
-       "../core",
-       "../core/stripAndCollapse",
-       "../core/nodeName",
+import jQuery from "../core.js";
+import stripAndCollapse from "../core/stripAndCollapse.js";
+import nodeName from "../core/nodeName.js";
 
-       "../core/init"
-], function( jQuery, stripAndCollapse, nodeName ) {
-
-"use strict";
+import "../core/init.js";
 
 var rreturn = /\r/g;
 
@@ -147,15 +143,11 @@ jQuery.extend( {
                                while ( i-- ) {
                                        option = options[ i ];
 
-                                       /* eslint-disable no-cond-assign */
-
-                                       if ( option.selected =
+                                       if ( ( option.selected =
                                                jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
-                                       ) {
+                                       ) {
                                                optionSet = true;
                                        }
-
-                                       /* eslint-enable no-cond-assign */
                                }
 
                                // Force browsers to behave consistently when non-matching value is set
@@ -178,5 +170,3 @@ jQuery.each( [ "radio", "checkbox" ], function() {
                }
        };
 } );
-
-} );
index 140c4979ea0bd4798c430ee760ff6d1b34def047..19b3d7c1cf13d0fbec3f6469da5064b8c5e05a37 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "./core",
-       "./core/toType",
-       "./var/rnothtmlwhite"
-], function( jQuery, toType, rnothtmlwhite ) {
-
-"use strict";
+import jQuery from "./core.js";
+import toType from "./core/toType.js";
+import rnothtmlwhite from "./var/rnothtmlwhite.js";
 
 // Convert String-formatted options into Object-formatted ones
 function createOptions( options ) {
@@ -231,5 +227,4 @@ jQuery.Callbacks = function( options ) {
        return self;
 };
 
-return jQuery;
-} );
+export default jQuery;
index af5d44214494e13aa0dc91aa887849bff7ae15d8..7ea77c4f0f99387fd95685887cc884d5f7743b73 100644 (file)
@@ -1,29 +1,21 @@
-/* global Symbol */
-// Defining this global in .eslintrc.json would create a danger of using the global
-// unguarded in another place, it seems safer to define global only for this module
-
-define( [
-       "./var/arr",
-       "./var/getProto",
-       "./var/slice",
-       "./var/flat",
-       "./var/push",
-       "./var/indexOf",
-       "./var/class2type",
-       "./var/toString",
-       "./var/hasOwn",
-       "./var/fnToString",
-       "./var/ObjectFunctionString",
-       "./var/support",
-       "./var/isWindow",
-       "./core/DOMEval",
-       "./core/toType"
-], function( arr, getProto, slice, flat, push, indexOf,
-       class2type, toString, hasOwn, fnToString, ObjectFunctionString,
-       support, isWindow, DOMEval, toType ) {
-
-"use strict";
-
+import arr from "./var/arr.js";
+import getProto from "./var/getProto.js";
+import slice from "./var/slice.js";
+import flat from "./var/flat.js";
+import push from "./var/push.js";
+import indexOf from "./var/indexOf.js";
+import class2type from "./var/class2type.js";
+import toString from "./var/toString.js";
+import hasOwn from "./var/hasOwn.js";
+import fnToString from "./var/fnToString.js";
+import ObjectFunctionString from "./var/ObjectFunctionString.js";
+import support from "./var/support.js";
+import isWindow from "./var/isWindow.js";
+import DOMEval from "./core/DOMEval.js";
+import toType from "./core/toType.js";
+
+// When custom compilation is used, the version string can get large.
+// eslint-disable-next-line max-len
 var version = "@VERSION",
 
        rhtmlSuffix = /HTML$/i,
@@ -431,5 +423,4 @@ function isArrayLike( obj ) {
                typeof length === "number" && length > 0 && ( length - 1 ) in obj;
 }
 
-return jQuery;
-} );
+export default jQuery;
index df83cca529454fa4e392e1e5c5bb26b5d91f7011..b0238fd69213a306ca38e4cc2037976263b3083d 100644 (file)
@@ -1,43 +1,39 @@
-define( [
-       "../var/document"
-], function( document ) {
-       "use strict";
+import document from "../var/document.js";
 
-       var preservedScriptAttributes = {
-               type: true,
-               src: true,
-               nonce: true,
-               noModule: true
-       };
+var preservedScriptAttributes = {
+       type: true,
+       src: true,
+       nonce: true,
+       noModule: true
+};
 
-       function DOMEval( code, node, doc ) {
-               doc = doc || document;
+function DOMEval( code, node, doc ) {
+       doc = doc || document;
 
-               var i, val,
-                       script = doc.createElement( "script" );
+       var i, val,
+               script = doc.createElement( "script" );
 
-               script.text = code;
-               if ( node ) {
-                       for ( i in preservedScriptAttributes ) {
+       script.text = code;
+       if ( node ) {
+               for ( i in preservedScriptAttributes ) {
 
-                               // Support: Firefox <=64 - 66+, Edge <=18+
-                               // Some browsers don't support the "nonce" property on scripts.
-                               // On the other hand, just using `getAttribute` is not enough as
-                               // the `nonce` attribute is reset to an empty string whenever it
-                               // becomes browsing-context connected.
-                               // See https://github.com/whatwg/html/issues/2369
-                               // See https://html.spec.whatwg.org/#nonce-attributes
-                               // The `node.getAttribute` check was added for the sake of
-                               // `jQuery.globalEval` so that it can fake a nonce-containing node
-                               // via an object.
-                               val = node[ i ] || node.getAttribute && node.getAttribute( i );
-                               if ( val ) {
-                                       script.setAttribute( i, val );
-                               }
+                       // Support: Firefox <=64 - 66+, Edge <=18+
+                       // Some browsers don't support the "nonce" property on scripts.
+                       // On the other hand, just using `getAttribute` is not enough as
+                       // the `nonce` attribute is reset to an empty string whenever it
+                       // becomes browsing-context connected.
+                       // See https://github.com/whatwg/html/issues/2369
+                       // See https://html.spec.whatwg.org/#nonce-attributes
+                       // The `node.getAttribute` check was added for the sake of
+                       // `jQuery.globalEval` so that it can fake a nonce-containing node
+                       // via an object.
+                       val = node[ i ] || node.getAttribute && node.getAttribute( i );
+                       if ( val ) {
+                               script.setAttribute( i, val );
                        }
                }
-               doc.head.appendChild( script ).parentNode.removeChild( script );
        }
+       doc.head.appendChild( script ).parentNode.removeChild( script );
+}
 
-       return DOMEval;
-} );
+export default DOMEval;
index e088a65579abd40e4aee70e5e8193db3a9118d38..4eaec46957dfd2f6a38b052778c99051c0821819 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../core",
-       "../core/toType"
-], function( jQuery, toType ) {
-
-"use strict";
+import jQuery from "../core.js";
+import toType from "../core/toType.js";
 
 // Multifunctional method to get and set values of a collection
 // The value/s can optionally be executed if it's a function
@@ -66,6 +62,4 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
        return len ? fn( elems[ 0 ], key ) : emptyGet;
 };
 
-return access;
-
-} );
+export default access;
index 61ed90d051f94964199d3518f36ba2a9aaed2090..f12a2c67d128ca17e5b1beed87e76a4699c96512 100644 (file)
@@ -1,7 +1,3 @@
-define( [], function() {
-
-"use strict";
-
 // Matches dashed string for camelizing
 var rdashAlpha = /-([a-z])/g;
 
@@ -15,6 +11,4 @@ function camelCase( string ) {
        return string.replace( rdashAlpha, fcamelCase );
 }
 
-return camelCase;
-
-} );
+export default camelCase;
index 71f30e926fdfa9b872f75df767303d28c1e8e60e..c2f35e1f45eda98298ca833c0363b95a005f9faa 100644 (file)
@@ -1,13 +1,9 @@
 // Initialize a jQuery object
-define( [
-       "../core",
-       "../var/document",
-       "./var/rsingleTag",
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import rsingleTag from "./var/rsingleTag.js";
 
-       "../traversing/findFilter"
-], function( jQuery, document, rsingleTag ) {
-
-"use strict";
+import "../traversing/findFilter.js";
 
 // A central reference to the root jQuery(document)
 var rootjQuery,
@@ -123,6 +119,4 @@ init.prototype = jQuery.fn;
 // Initialize central reference
 rootjQuery = jQuery( document );
 
-return init;
-
-} );
+export default init;
index 579bcffb226753b9dd0c326977cefca69ec82c28..3857d94a861cde94414c576e92a23c488d5d0043 100644 (file)
@@ -1,23 +1,20 @@
-define( [
-       "../core",
-       "../var/documentElement",
-       "../selector/contains" // jQuery.contains
-], function( jQuery, documentElement ) {
-       "use strict";
+import jQuery from "../core.js";
+import documentElement from "../var/documentElement.js";
 
-       var isAttached = function( elem ) {
-                       return jQuery.contains( elem.ownerDocument, elem );
-               },
-               composed = { composed: true };
+import "../selector/contains.js"; // jQuery.contains
 
-       // Support: IE 9 - 11+, Edge 12 - 18+
-       // Check attachment across shadow DOM boundaries when possible (gh-3504)
-       if ( documentElement.getRootNode ) {
-               isAttached = function( elem ) {
-                       return jQuery.contains( elem.ownerDocument, elem ) ||
-                               elem.getRootNode( composed ) === elem.ownerDocument;
-               };
-       }
+var isAttached = function( elem ) {
+               return jQuery.contains( elem.ownerDocument, elem );
+       },
+       composed = { composed: true };
 
-       return isAttached;
-} );
+// Support: IE 9 - 11+, Edge 12 - 18+
+// Check attachment across shadow DOM boundaries when possible (gh-3504)
+if ( documentElement.getRootNode ) {
+       isAttached = function( elem ) {
+               return jQuery.contains( elem.ownerDocument, elem ) ||
+                       elem.getRootNode( composed ) === elem.ownerDocument;
+       };
+}
+
+export default isAttached;
index 8a5f5f036473cbe1b5e6aff48b1deb312be186f8..d10e484bc779d3e5d1d42bed2416a6d79248776e 100644 (file)
@@ -1,13 +1,7 @@
-define( function() {
-
-"use strict";
-
 function nodeName( elem, name ) {
 
   return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
 
 };
 
-return nodeName;
-
-} );
+export default nodeName;
index 8c5268fb1e2296fbab5f6a3020926e478b170626..15278fa0242ab5eb06c2ddf4e61cb227fb95524e 100644 (file)
@@ -1,11 +1,7 @@
-define( [
-       "../core",
-       "../var/document",
-       "./var/rsingleTag",
-       "../manipulation/buildFragment"
-], function( jQuery, document, rsingleTag, buildFragment ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import rsingleTag from "./var/rsingleTag.js";
+import buildFragment from "../manipulation/buildFragment.js";
 
 // Argument "data" should be string of html
 // context (optional): If specified, the fragment will be created in this context,
@@ -52,7 +48,3 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
 
        return jQuery.merge( [], parsed.childNodes );
 };
-
-return jQuery.parseHTML;
-
-} );
index 2c3fc1b846eea2161ab9fcdb2fb5806dfb906be8..51f6d7f6b71718e96247a5ab1024dd3583c69371 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../core",
-       "../var/document"
-], function( jQuery, document ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
 
 var readyCallbacks = [],
        whenReady = function( fn ) {
@@ -89,5 +85,3 @@ if ( document.readyState !== "loading" ) {
        // A fallback to window.onload, that will always work
        window.addEventListener( "load", completed );
 }
-
-} );
index 3abb6c03a3916d51159ae0f1f634e63dfa311186..d6c507e41c1aa1dfa98e60b1d4b14e5127536ce5 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "../core",
-       "../var/document",
-       "../core/readyException",
-       "../deferred"
-], function( jQuery, document ) {
+import jQuery from "../core.js";
+import document from "../var/document.js";
 
-"use strict";
+import "../core/readyException.js";
+import "../deferred.js";
 
 // The deferred used on DOM ready
 var readyList = jQuery.Deferred();
@@ -79,5 +76,3 @@ if ( document.readyState !== "loading" ) {
        // A fallback to window.onload, that will always work
        window.addEventListener( "load", completed );
 }
-
-} );
index 72bdd90b54a811a683330fcce51a9e539eea3950..1b5512c15f2a10a58f2930df74e10cf0b8fb4a84 100644 (file)
@@ -1,13 +1,7 @@
-define( [
-       "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 jQuery.readyException = function( error ) {
        window.setTimeout( function() {
                throw error;
        } );
 };
-
-} );
index 2b63820dadfaeb8a20b0a1fa92fe35313ca69128..944a79362d2eaadefba3a8d29162bb55f203a6c3 100644 (file)
@@ -1,14 +1,10 @@
-define( [
-       "../var/rnothtmlwhite"
-], function( rnothtmlwhite ) {
-       "use strict";
+import rnothtmlwhite from "../var/rnothtmlwhite.js";
 
-       // Strip and collapse whitespace according to HTML spec
-       // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
-       function stripAndCollapse( value ) {
-               var tokens = value.match( rnothtmlwhite ) || [];
-               return tokens.join( " " );
-       }
+// Strip and collapse whitespace according to HTML spec
+// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
+function stripAndCollapse( value ) {
+       var tokens = value.match( rnothtmlwhite ) || [];
+       return tokens.join( " " );
+}
 
-       return stripAndCollapse;
-} );
+export default stripAndCollapse;
index c555ef9df2c681e07ca2d0c212dab6a6272cb3fa..67af8a67ff590841201798b561c35d9e24eb6755 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../var/class2type",
-       "../var/toString"
-], function( class2type, toString ) {
-
-"use strict";
+import class2type from "../var/class2type.js";
+import toString from "../var/toString.js";
 
 function toType( obj ) {
        if ( obj == null ) {
@@ -15,5 +11,4 @@ function toType( obj ) {
                typeof obj;
 }
 
-return toType;
-} );
+export default toType;
index d7921aa3b18ef3d7fa7072c5a1a326fc56b0d204..3dace14c522f1f45813e0c61185ef1f09c69c6a8 100644 (file)
@@ -1,7 +1 @@
-define( function() {
-
-"use strict";
-
-return ( /HTML$/i );
-
-} );
+export default ( /HTML$/i );
index 340b80db0706694265c8c5a672744203098f1317..5bf52d5684f316dfd2ae19820a3a26dba10f81aa 100644 (file)
@@ -1,7 +1,3 @@
-define( function() {
-       "use strict";
-
-       // rsingleTag matches a string consisting of a single HTML element with no attributes
-       // and captures the element's name
-       return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
-} );
+// rsingleTag matches a string consisting of a single HTML element with no attributes
+// and captures the element's name
+export default ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
index c700c0aa50ec2ecbc50bceb05fb30e5e195096ba..6d67ffaa77e1334dd50688ca8463776642ef1307 100644 (file)
@@ -1,27 +1,22 @@
-define( [
-       "./core",
-       "./core/access",
-       "./core/nodeName",
-       "./var/rcssNum",
-       "./var/isIE",
-       "./css/var/rnumnonpx",
-       "./css/var/cssExpand",
-       "./css/isAutoPx",
-       "./css/cssCamelCase",
-       "./css/var/getStyles",
-       "./css/var/swap",
-       "./css/curCSS",
-       "./css/adjustCSS",
-       "./css/support",
-       "./css/finalPropName",
-
-       "./core/init",
-       "./core/ready",
-       "./selector" // contains
-], function( jQuery, access, nodeName, rcssNum, isIE, rnumnonpx, cssExpand, isAutoPx,
-       cssCamelCase, getStyles, swap, curCSS, adjustCSS, support, finalPropName ) {
-
-"use strict";
+import jQuery from "./core.js";
+import access from "./core/access.js";
+import nodeName from "./core/nodeName.js";
+import rcssNum from "./var/rcssNum.js";
+import isIE from "./var/isIE.js";
+import rnumnonpx from "./css/var/rnumnonpx.js";
+import cssExpand from "./css/var/cssExpand.js";
+import isAutoPx from "./css/isAutoPx.js";
+import cssCamelCase from "./css/cssCamelCase.js";
+import getStyles from "./css/var/getStyles.js";
+import swap from "./css/var/swap.js";
+import curCSS from "./css/curCSS.js";
+import adjustCSS from "./css/adjustCSS.js";
+import support from "./css/support.js";
+import finalPropName from "./css/finalPropName.js";
+
+import "./core/init.js";
+import "./core/ready.js";
+import "./selector.js"; // contains
 
 var
 
@@ -426,5 +421,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index 5341a7890609d948c136cca8569e2fd5581d1b0e..d973ff3869caef5ee4426c1943a66393657dbeab 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../core",
-       "./isAutoPx",
-       "../var/rcssNum"
-], function( jQuery, isAutoPx, rcssNum ) {
-
-"use strict";
+import jQuery from "../core.js";
+import isAutoPx from "./isAutoPx.js";
+import rcssNum from "../var/rcssNum.js";
 
 function adjustCSS( elem, prop, valueParts, tween ) {
        var adjusted, scale,
@@ -71,5 +67,4 @@ function adjustCSS( elem, prop, valueParts, tween ) {
        return adjusted;
 }
 
-return adjustCSS;
-} );
+export default adjustCSS;
index 9b5c328ad08fa7583013692da98a6927b4c92740..895303248ce398fbac3b9a25c788f6ab1b2e196e 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core/camelCase"
-], function( camelCase ) {
-
-"use strict";
+import camelCase from "../core/camelCase.js";
 
 // Matches dashed string for camelizing
 var rmsPrefix = /^-ms-/;
@@ -15,6 +11,4 @@ function cssCamelCase( string ) {
        return camelCase( string.replace( rmsPrefix, "ms-" ) );
 }
 
-return cssCamelCase;
-
-} );
+export default cssCamelCase;
index 882e7423e6a537e73c562d18bce0c255afdd3854..59a639f688abd7ebce3c426e98a77a6f970b6b4a 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../core",
-       "../core/isAttached",
-       "./var/getStyles"
-], function( jQuery, isAttached, getStyles ) {
-
-"use strict";
+import jQuery from "../core.js";
+import isAttached from "../core/isAttached.js";
+import getStyles from "./var/getStyles.js";
 
 function curCSS( elem, name, computed ) {
        var ret;
@@ -28,5 +24,4 @@ function curCSS( elem, name, computed ) {
                ret;
 }
 
-return curCSS;
-} );
+export default curCSS;
index c290eb2b412318c60a2a3337a3f9186cd1a03824..40d2fb193f594e348f3fb2e2fce3f371fc3bcfcc 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../var/document"
-], function( document ) {
-
-"use strict";
+import document from "../var/document.js";
 
 var cssPrefixes = [ "Webkit", "Moz", "ms" ],
        emptyStyle = document.createElement( "div" ).style,
@@ -36,6 +32,4 @@ function finalPropName( name ) {
        return vendorProps[ name ] = vendorPropName( name ) || name;
 }
 
-return finalPropName;
-
-} );
+export default finalPropName;
index d7a9339dd1338d15bdc2749efe83553a6646c009..1f892dfe007242138f6cfade11833561493373a0 100644 (file)
@@ -1,9 +1,6 @@
-define( [
-       "../core",
-       "../selector"
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../selector.js";
 
 jQuery.expr.pseudos.hidden = function( elem ) {
        return !jQuery.expr.pseudos.visible( elem );
@@ -11,5 +8,3 @@ jQuery.expr.pseudos.hidden = function( elem ) {
 jQuery.expr.pseudos.visible = function( elem ) {
        return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
 };
-
-} );
index ff4b7def1bd46c30df2932f1d1f2e14cfd2bac60..a55d5bbcca78d3b879361af751f97e6d8fb86b93 100644 (file)
@@ -1,7 +1,3 @@
-define( function() {
-
-"use strict";
-
 var ralphaStart = /^[a-z]/,
 
        // The regex visualized:
@@ -36,6 +32,4 @@ function isAutoPx( prop ) {
                rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
 };
 
-return isAutoPx;
-
-} );
+export default isAutoPx;
index 3eeafef116d9c90f67cb7ce2e14446d5eea7e24b..dc273f98c61eb326eb65427a3f770baf35207354 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../core",
-       "../data/var/dataPriv",
-       "../css/var/isHiddenWithinTree"
-], function( jQuery, dataPriv, isHiddenWithinTree ) {
-
-"use strict";
+import jQuery from "../core.js";
+import dataPriv from "../data/var/dataPriv.js";
+import isHiddenWithinTree from "../css/var/isHiddenWithinTree.js";
 
 var defaultDisplayMap = {};
 
@@ -101,5 +97,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return showHide;
-} );
+export default showHide;
index 053f494b263004c9b4a1faf661b3a0fc647549f1..505adafb69540bc70ccc888cb8eae595750d5b37 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../var/document",
-       "../var/documentElement",
-       "../var/support"
-], function( document, documentElement, support ) {
-
-"use strict";
+import document from "../var/document.js";
+import documentElement from "../var/documentElement.js";
+import support from "../var/support.js";
 
 var reliableTrDimensionsVal;
 
@@ -35,6 +31,4 @@ support.reliableTrDimensions = function() {
        return reliableTrDimensionsVal;
 };
 
-return support;
-
-} );
+export default support;
index dd2007c3fb6a14dd0c6c356e5daf7b62da1d8113..66062e2ee220d2d000c2290cbcfd7933804de1b7 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return [ "Top", "Right", "Bottom", "Left" ];
-} );
+export default [ "Top", "Right", "Bottom", "Left" ];
index 7adbdcfb5125d961289b0a241d1f6782c97b4ed0..e55da23efac9af21044c5f004f669aaccb508035 100644 (file)
@@ -1,19 +1,15 @@
-define( function() {
-       "use strict";
+export default function( elem ) {
 
-       return function( elem ) {
+       // Support: IE <=11+ (trac-14150)
+       // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
+       // break. Using `elem.ownerDocument.defaultView` avoids the issue.
+       var view = elem.ownerDocument.defaultView;
 
-               // Support: IE <=11+ (trac-14150)
-               // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
-               // break. Using `elem.ownerDocument.defaultView` avoids the issue.
-               var view = elem.ownerDocument.defaultView;
+       // `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView`
+       // property; check `defaultView` truthiness to fallback to window in such a case.
+       if ( !view ) {
+               view = window;
+       }
 
-               // `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView`
-               // property; check `defaultView` truthiness to fallback to window in such a case.
-               if ( !view ) {
-                       view = window;
-               }
-
-               return view.getComputedStyle( elem );
-       };
-} );
+       return view.getComputedStyle( elem );
+};
index 1e99b96d30027f3ef05da82b714d0bae3237a416..0cc1631789ee542c1a4f07d926aa9bbe24e7adba 100644 (file)
@@ -1,26 +1,20 @@
-define( [
-       "../../core"
+import jQuery from "../../core.js";
 
-       // css is assumed
-], function( jQuery ) {
-       "use strict";
+// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
+// through the CSS cascade), which is useful in deciding whether or not to make it visible.
+// It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
+// * A hidden ancestor does not force an element to be classified as hidden.
+// * Being disconnected from the document does not force an element to be classified as hidden.
+// These differences improve the behavior of .toggle() et al. when applied to elements that are
+// detached or contained within hidden ancestors (gh-2404, gh-2863).
+export default function( elem, el ) {
 
-       // isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
-       // through the CSS cascade), which is useful in deciding whether or not to make it visible.
-       // It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
-       // * A hidden ancestor does not force an element to be classified as hidden.
-       // * Being disconnected from the document does not force an element to be classified as hidden.
-       // These differences improve the behavior of .toggle() et al. when applied to elements that are
-       // detached or contained within hidden ancestors (gh-2404, gh-2863).
-       return function( elem, el ) {
+       // isHiddenWithinTree might be called from jQuery#filter function;
+       // in that case, element will be second argument
+       elem = el || elem;
 
-               // isHiddenWithinTree might be called from jQuery#filter function;
-               // in that case, element will be second argument
-               elem = el || elem;
-
-               // Inline style trumps all
-               return elem.style.display === "none" ||
-                       elem.style.display === "" &&
-                       jQuery.css( elem, "display" ) === "none";
-       };
-} );
+       // Inline style trumps all
+       return elem.style.display === "none" ||
+               elem.style.display === "" &&
+               jQuery.css( elem, "display" ) === "none";
+};
index 056cda7add66c907d258c1cdc1fd2dd641e55722..18a9dad6c81da7ae69f2ad3cb1fa32c086f792ac 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "../../var/pnum"
-], function( pnum ) {
-       "use strict";
+import pnum from "../../var/pnum.js";
 
-       return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
-} );
+export default new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
index 69388e5f7fbddd4c890586b05b62982cd13ade8e..e720fff9b998e09b2bb29c6e85139c85b16aa215 100644 (file)
@@ -1,9 +1,5 @@
-define( function() {
-
-"use strict";
-
 // A method for quickly swapping in/out CSS properties to get correct calculations.
-return function( elem, options, callback ) {
+export default function( elem, options, callback ) {
        var ret, name,
                old = {};
 
@@ -22,5 +18,3 @@ return function( elem, options, callback ) {
 
        return ret;
 };
-
-} );
index d6706493aba42f0e7fc88645dcb9f220c47fa2e6..cd658b386c9c167c645643d7ef542d21b009c6ea 100644 (file)
@@ -1,12 +1,8 @@
-define( [
-       "./core",
-       "./core/access",
-       "./core/camelCase",
-       "./data/var/dataPriv",
-       "./data/var/dataUser"
-], function( jQuery, access, camelCase, dataPriv, dataUser ) {
-
-"use strict";
+import jQuery from "./core.js";
+import access from "./core/access.js";
+import camelCase from "./core/camelCase.js";
+import dataPriv from "./data/var/dataPriv.js";
+import dataUser from "./data/var/dataUser.js";
 
 //     Implementation Summary
 //
@@ -176,5 +172,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index c94480fcd57d56f4f0d6732e5fc6a8cceee44c9e..556f4e39c092b61641deda85a99fcd19aa2497c5 100644 (file)
@@ -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;
index e00f7538b3961c0a529adf0ea6ee70b72f83ad68..4fc47b30a08fe8b259898c17cca9a31b39dc4bab 100644 (file)
@@ -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 );
 };
-
-} );
index 72713c88cccb3d23bbd16eeb657d6b6bd8e35cfd..94ea1190e66d239d312cbd8c2f2adca6370ce80e 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "../Data"
-], function( Data ) {
-       "use strict";
+import Data from "../Data.js";
 
-       return new Data();
-} );
+export default new Data();
index 72713c88cccb3d23bbd16eeb657d6b6bd8e35cfd..94ea1190e66d239d312cbd8c2f2adca6370ce80e 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "../Data"
-], function( Data ) {
-       "use strict";
+import Data from "../Data.js";
 
-       return new Data();
-} );
+export default new Data();
index 771e8381b1bfa8d6e46b2a7dc3eb5b2eb9e56fe2..d4eaf7a4bcf412b117f5218ddfa0472d44103fe2 100644 (file)
@@ -1,10 +1,7 @@
-define( [
-       "./core",
-       "./var/slice",
-       "./callbacks"
-], function( jQuery, slice ) {
+import jQuery from "./core.js";
+import slice from "./var/slice.js";
 
-"use strict";
+import "./callbacks.js";
 
 function Identity( v ) {
        return v;
@@ -392,5 +389,4 @@ jQuery.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index f6faf41231d2096b6074035b3eb7cf72e88ed763..2e3c7cc35ce87530bc7ec0641c3517738bff7d2f 100644 (file)
@@ -1,9 +1,6 @@
-define( [
-       "../core",
-       "../deferred"
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../deferred.js";
 
 // These usually indicate a programmer mistake during development,
 // warn about them ASAP rather than swallowing them by default.
@@ -19,5 +16,3 @@ jQuery.Deferred.exceptionHook = function( error, stack ) {
                );
        }
 };
-
-} );
index 11728081c8878592420423ca58f7b21012142fa3..b7879c208543526648603141fb4d88a9b0ef36ff 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "./core",
-       "./var/slice",
-       "./var/trim",
-       "./event/alias"
-], function( jQuery, slice, trim ) {
+import jQuery from "./core.js";
+import slice from "./var/slice.js";
+import trim from "./var/trim.js";
 
-"use strict";
+import "./event/alias.js";
 
 jQuery.fn.extend( {
 
@@ -70,4 +67,3 @@ jQuery.holdReady = function( hold ) {
 jQuery.trim = function( text ) {
        return text == null ? "" : trim.call( text );
 };
-} );
index 2a2c0391df5ac34cc4800670191cee39709ff661..6f1bf7d2f558b78cdf59998326010ff894b98116 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "./core",
-       "./core/access",
-       "./var/isWindow",
-       "./css"
-], function( jQuery, access, isWindow ) {
+import jQuery from "./core.js";
+import access from "./core/access.js";
+import isWindow from "./var/isWindow.js";
 
-"use strict";
+import "./css.js";
 
 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
@@ -53,5 +50,4 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
        } );
 } );
 
-return jQuery;
-} );
+export default jQuery;
index 46ad988ada64d76003dc904001a568fe784ab59d..030d3c7ba0717e9773d4cc3739dbb4fcfb416582 100644 (file)
@@ -1,26 +1,21 @@
-define( [
-       "./core",
-       "./var/document",
-       "./var/rcssNum",
-       "./var/rnothtmlwhite",
-       "./css/var/cssExpand",
-       "./css/var/isHiddenWithinTree",
-       "./css/adjustCSS",
-       "./css/cssCamelCase",
-       "./data/var/dataPriv",
-       "./css/showHide",
-
-       "./core/init",
-       "./queue",
-       "./deferred",
-       "./traversing",
-       "./manipulation",
-       "./css",
-       "./effects/Tween"
-], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand,
-       isHiddenWithinTree, adjustCSS, cssCamelCase, dataPriv, showHide ) {
-
-"use strict";
+import jQuery from "./core.js";
+import document from "./var/document.js";
+import rcssNum from "./var/rcssNum.js";
+import rnothtmlwhite from "./var/rnothtmlwhite.js";
+import cssExpand from "./css/var/cssExpand.js";
+import isHiddenWithinTree from "./css/var/isHiddenWithinTree.js";
+import adjustCSS from "./css/adjustCSS.js";
+import cssCamelCase from "./css/cssCamelCase.js";
+import dataPriv from "./data/var/dataPriv.js";
+import showHide from "./css/showHide.js";
+
+import "./core/init.js";
+import "./queue.js";
+import "./deferred.js";
+import "./traversing.js";
+import "./manipulation.js";
+import "./css.js";
+import "./effects/Tween.js";
 
 var
        fxNow, inProgress,
@@ -225,12 +220,9 @@ function defaultPrefilter( elem, props, opts ) {
                                showHide( [ elem ], true );
                        }
 
-                       /* eslint-disable no-loop-func */
-
+                       // eslint-disable-next-line no-loop-func
                        anim.done( function() {
 
-                       /* eslint-enable no-loop-func */
-
                                // The final step of a "hide" animation is actually hiding the element
                                if ( !hidden ) {
                                        showHide( [ elem ] );
@@ -693,5 +685,4 @@ jQuery.fx.speeds = {
        _default: 400
 };
 
-return jQuery;
-} );
+export default jQuery;
index 0c5fe67d35d50c72afe63b73dad2aefd89487bae..9a75a9af2760650df269faa7e1fe0a182b77bb39 100644 (file)
@@ -1,12 +1,8 @@
-define( [
-       "../core",
-       "../css/isAutoPx",
-       "../css/finalPropName",
+import jQuery from "../core.js";
+import isAutoPx from "../css/isAutoPx.js";
+import finalPropName from "../css/finalPropName.js";
 
-       "../css"
-], function( jQuery, isAutoPx, finalPropName ) {
-
-"use strict";
+import "../css.js";
 
 function Tween( elem, options, prop, end, easing ) {
        return new Tween.prototype.init( elem, options, prop, end, easing );
@@ -112,5 +108,3 @@ jQuery.fx = Tween.prototype.init;
 
 // Back compat <1.8 extension point
 jQuery.fx.step = {};
-
-} );
index 24c1bfba2c41e0f4a004ee4148f95f5176567289..327956f72a0bada8315c44a327c4a56e470fdbed 100644 (file)
@@ -1,15 +1,10 @@
-define( [
-       "../core",
-       "../selector",
-       "../effects"
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../selector.js";
+import "../effects.js";
 
 jQuery.expr.pseudos.animated = function( elem ) {
        return jQuery.grep( jQuery.timers, function( fn ) {
                return elem === fn.elem;
        } ).length;
 };
-
-} );
index 405d176a0e7fe40233375d9b0a3a2604f4bad433..7f66d49de2831a9d494bbb944420c4afbce55519 100644 (file)
@@ -1,19 +1,14 @@
-define( [
-       "./core",
-       "./var/document",
-       "./var/documentElement",
-       "./var/rnothtmlwhite",
-       "./var/rcheckableType",
-       "./var/slice",
-       "./data/var/dataPriv",
-       "./core/nodeName",
-
-       "./core/init",
-       "./selector"
-], function( jQuery, document, documentElement, rnothtmlwhite,
-       rcheckableType, slice, dataPriv, nodeName ) {
-
-"use strict";
+import jQuery from "./core.js";
+import document from "./var/document.js";
+import documentElement from "./var/documentElement.js";
+import rnothtmlwhite from "./var/rnothtmlwhite.js";
+import rcheckableType from "./var/rcheckableType.js";
+import slice from "./var/slice.js";
+import dataPriv from "./data/var/dataPriv.js";
+import nodeName from "./core/nodeName.js";
+
+import "./core/init.js";
+import "./selector.js";
 
 var
        rkeyEvent = /^key/,
@@ -857,5 +852,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index dd9c0ffe2c077948a5779bf2ba70180dc33de3fd..8c64d9b3e5eba34c76113ee5102cf405b626b70f 100644 (file)
@@ -1,9 +1,6 @@
-define( [
-       "../core",
-       "../event"
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../event.js";
 
 // Attach a bunch of functions for handling common AJAX events
 jQuery.each( [
@@ -18,5 +15,3 @@ jQuery.each( [
                return this.on( type, fn );
        };
 } );
-
-} );
index 46bd1ae80c12107844d98ae2fb29bf8d46bf8573..346951b11cd30c8b11d5bdd899b7fb5e591e552c 100644 (file)
@@ -1,11 +1,7 @@
-define( [
-       "../core",
+import jQuery from "../core.js";
 
-       "../event",
-       "./trigger"
-], function( jQuery ) {
-
-"use strict";
+import "../event.js";
+import "./trigger.js";
 
 jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
        "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
@@ -25,5 +21,3 @@ jQuery.fn.extend( {
                return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
        }
 } );
-
-} );
index 39f641b70bbf75a797538955e6a09f85a592f009..aba4c7eddba15181cc4d5d74c080a296bf990e50 100644 (file)
@@ -1,14 +1,11 @@
-define( [
-       "../core",
-       "../var/document",
-       "../data/var/dataPriv",
-       "../data/var/acceptData",
-       "../var/hasOwn",
-       "../var/isWindow",
-       "../event"
-], function( jQuery, document, dataPriv, acceptData, hasOwn, isWindow ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import dataPriv from "../data/var/dataPriv.js";
+import acceptData from "../data/var/acceptData.js";
+import hasOwn from "../var/hasOwn.js";
+import isWindow from "../var/isWindow.js";
+
+import "../event.js";
 
 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
        stopPropagationCallback = function( e ) {
@@ -194,5 +191,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index cbb1ef58068c449cea597dcbd242c058e1aaff0a..44587ab3a903e8d74a51688b4a15ca8e972fb083 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 // Register as a named AMD module, since jQuery can be concatenated with other
 // files that may use define, but not via a proper concatenation script that
@@ -22,5 +18,3 @@ if ( typeof define === "function" && define.amd ) {
                return jQuery;
        } );
 }
-
-} );
index 460b56e4783035fa9c69765a998cb07b1e9c919a..b49496fbb0a4f2d830b165935025c68e75b53128 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core"
-], function( jQuery, noGlobal ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 var
 
@@ -27,8 +23,6 @@ jQuery.noConflict = function( deep ) {
 // Expose jQuery and $ identifiers, even in AMD
 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
 // and CommonJS for browser emulators (#13566)
-if ( !noGlobal ) {
+if ( typeof noGlobal === "undefined" ) {
        window.jQuery = window.$ = jQuery;
 }
-
-} );
index aee1a6387097bffbd9e00276e9a10aa808c66dd8..24e58a93ccc83b27810177f7b6aa969c7f230c32 100644 (file)
@@ -1,39 +1,35 @@
-define( [
-       "./core",
-       "./selector",
-       "./traversing",
-       "./callbacks",
-       "./deferred",
-       "./deferred/exceptionHook",
-       "./core/ready",
-       "./data",
-       "./queue",
-       "./queue/delay",
-       "./attributes",
-       "./event",
-       "./manipulation",
-       "./manipulation/_evalUrl",
-       "./wrap",
-       "./css",
-       "./css/hiddenVisibleSelectors",
-       "./serialize",
-       "./ajax",
-       "./ajax/xhr",
-       "./ajax/script",
-       "./ajax/jsonp",
-       "./ajax/load",
-       "./event/ajax",
-       "./effects",
-       "./effects/animatedSelector",
-       "./offset",
-       "./dimensions",
-       "./deprecated",
-       "./exports/amd",
-       "./exports/global"
-], function( jQuery ) {
+import jQuery from "./core.js";
 
-"use strict";
+import "./selector.js";
+import "./traversing.js";
+import "./callbacks.js";
+import "./deferred.js";
+import "./deferred/exceptionHook.js";
+import "./core/ready.js";
+import "./data.js";
+import "./queue.js";
+import "./queue/delay.js";
+import "./attributes.js";
+import "./event.js";
+import "./manipulation.js";
+import "./manipulation/_evalUrl.js";
+import "./wrap.js";
+import "./css.js";
+import "./css/hiddenVisibleSelectors.js";
+import "./serialize.js";
+import "./ajax.js";
+import "./ajax/xhr.js";
+import "./ajax/script.js";
+import "./ajax/jsonp.js";
+import "./core/parseHTML.js";
+import "./ajax/load.js";
+import "./event/ajax.js";
+import "./effects.js";
+import "./effects/animatedSelector.js";
+import "./offset.js";
+import "./dimensions.js";
+import "./deprecated.js";
+import "./exports/amd.js";
+import "./exports/global.js";
 
-return jQuery;
-
-} );
+export default jQuery;
index 803a67bd6054eefaed4f5a514d6fa84635735c43..7140748edf95f14ee83240d6a6aec44ac4f3d3b3 100644 (file)
@@ -1,32 +1,25 @@
-define( [
-       "./core",
-       "./core/isAttached",
-       "./var/flat",
-       "./var/isIE",
-       "./var/push",
-       "./core/access",
-       "./manipulation/var/rtagName",
-       "./manipulation/var/rscriptType",
-       "./manipulation/wrapMap",
-       "./manipulation/getAll",
-       "./manipulation/setGlobalEval",
-       "./manipulation/buildFragment",
-
-       "./data/var/dataPriv",
-       "./data/var/dataUser",
-       "./data/var/acceptData",
-       "./core/DOMEval",
-       "./core/nodeName",
-
-       "./core/init",
-       "./traversing",
-       "./selector",
-       "./event"
-], function( jQuery, isAttached, flat, isIE, push, access, rtagName,
-       rscriptType, wrapMap, getAll, setGlobalEval, buildFragment,
-       dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
-
-"use strict";
+import jQuery from "./core.js";
+import isAttached from "./core/isAttached.js";
+import flat from "./var/flat.js";
+import isIE from "./var/isIE.js";
+import push from "./var/push.js";
+import access from "./core/access.js";
+import rtagName from "./manipulation/var/rtagName.js";
+import rscriptType from "./manipulation/var/rscriptType.js";
+import wrapMap from "./manipulation/wrapMap.js";
+import getAll from "./manipulation/getAll.js";
+import setGlobalEval from "./manipulation/setGlobalEval.js";
+import buildFragment from "./manipulation/buildFragment.js";
+import dataPriv from "./data/var/dataPriv.js";
+import dataUser from "./data/var/dataUser.js";
+import acceptData from "./data/var/acceptData.js";
+import DOMEval from "./core/DOMEval.js";
+import nodeName from "./core/nodeName.js";
+
+import "./core/init.js";
+import "./traversing.js";
+import "./selector.js";
+import "./event.js";
 
 var
 
@@ -458,5 +451,4 @@ jQuery.each( {
        };
 } );
 
-return jQuery;
-} );
+export default jQuery;
index 9a4d2ac6fda3abadae7c97fc3dd7a39d7e7e3422..54133fc9b5d028b640a867ae9e3570b9a9d8bc09 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../ajax"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../ajax.js";
 
 jQuery._evalUrl = function( url, options ) {
        return jQuery.ajax( {
@@ -27,6 +23,4 @@ jQuery._evalUrl = function( url, options ) {
        } );
 };
 
-return jQuery._evalUrl;
-
-} );
+export default jQuery._evalUrl;
index 01dcff6e5623a5d2088e132f54a880659f3df1ab..daf383aea95189c38e6575d0dbcf6bce10c3f31a 100644 (file)
@@ -1,15 +1,11 @@
-define( [
-       "../core",
-       "../core/toType",
-       "../core/isAttached",
-       "./var/rtagName",
-       "./var/rscriptType",
-       "./wrapMap",
-       "./getAll",
-       "./setGlobalEval"
-], function( jQuery, toType, isAttached, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) {
-
-"use strict";
+import jQuery from "../core.js";
+import toType from "../core/toType.js";
+import isAttached from "../core/isAttached.js";
+import rtagName from "./var/rtagName.js";
+import rscriptType from "./var/rscriptType.js";
+import wrapMap from "./wrapMap.js";
+import getAll from "./getAll.js";
+import setGlobalEval from "./setGlobalEval.js";
 
 var rhtml = /<|&#?\w+;/;
 
@@ -97,5 +93,4 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
        return fragment;
 }
 
-return buildFragment;
-} );
+export default buildFragment;
index 89634d694b524a3413d38d28863ec6c2605ce15f..995d22c0cd810901e07d8f85d8441fd95239d362 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../core",
-       "../core/nodeName"
-], function( jQuery, nodeName ) {
-
-"use strict";
+import jQuery from "../core.js";
+import nodeName from "../core/nodeName.js";
 
 function getAll( context, tag ) {
 
@@ -28,5 +24,4 @@ function getAll( context, tag ) {
        return ret;
 }
 
-return getAll;
-} );
+export default getAll;
index cf95240a480281b5a2df2f42f5c2e7827ca8aba4..c6f7ee9ab948093f1777a61be5841573b1dd67cf 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../data/var/dataPriv"
-], function( dataPriv ) {
-
-"use strict";
+import dataPriv from "../data/var/dataPriv.js";
 
 // Mark scripts as having already been evaluated
 function setGlobalEval( elems, refElements ) {
@@ -18,5 +14,4 @@ function setGlobalEval( elems, refElements ) {
        }
 }
 
-return setGlobalEval;
-} );
+export default setGlobalEval;
index cd1430a7e17e6f4429ae47290bf34a5cb5a60900..879651c7cc9b4039e5f8d775e7fc12abfd024864 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return ( /^$|^module$|\/(?:java|ecma)script/i );
-} );
+export default ( /^$|^module$|\/(?:java|ecma)script/i );
index 7435620c1914746013ff25fbb037836d94956294..b35acc999dc7d143a53fa81c5a1fcbb28cf195fa 100644 (file)
@@ -1,8 +1,4 @@
-define( function() {
-       "use strict";
-
-       // rtagName captures the name from the first start tag in a string of HTML
-       // https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state
-       // https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state
-       return ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
-} );
+// rtagName captures the name from the first start tag in a string of HTML
+// https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state
+// https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state
+export default ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
index 0652259285188efd25beb3b9b569f589220962d5..01937ecc35d8dddf00d6d690eb2cffa01f64ef83 100644 (file)
@@ -1,7 +1,3 @@
-define( function() {
-
-"use strict";
-
 // We have to close these tags to support XHTML (#13200)
 var wrapMap = {
 
@@ -21,5 +17,4 @@ var wrapMap = {
 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
 wrapMap.th = wrapMap.td;
 
-return wrapMap;
-} );
+export default wrapMap;
index 91c96d87700626cc92382d4bc020dec75b05206d..7d98083b9e6b5a6fb9bee5ab1557bb9a1aac40da 100644 (file)
@@ -1,14 +1,11 @@
-define( [
-       "./core",
-       "./core/access",
-       "./var/documentElement",
-       "./var/isWindow",
-       "./core/init",
-       "./css",
-       "./selector" // contains
-], function( jQuery, access, documentElement, isWindow ) {
-
-"use strict";
+import jQuery from "./core.js";
+import access from "./core/access.js";
+import documentElement from "./var/documentElement.js";
+import isWindow from "./var/isWindow.js";
+
+import "./core/init.js";
+import "./css.js";
+import "./selector.js"; // contains
 
 jQuery.offset = {
        setOffset: function( elem, options, i ) {
@@ -201,5 +198,4 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
        };
 } );
 
-return jQuery;
-} );
+export default jQuery;
index fbbbeab71aa492fc20066cccf7ebcf3a13872549..0028d7e7f5e76b3a38e413fa9f75b64363107d85 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "./core",
-       "./data/var/dataPriv",
-       "./deferred",
-       "./callbacks"
-], function( jQuery, dataPriv ) {
+import jQuery from "./core.js";
+import dataPriv from "./data/var/dataPriv.js";
 
-"use strict";
+import "./deferred.js";
+import "./callbacks.js";
 
 jQuery.extend( {
        queue: function( elem, type, data ) {
@@ -141,5 +138,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index d471eedc555f6d52b40de1c185b224ffb0fd8508..fe3a6f6b77b64b1720a2886927674bc37b12f153 100644 (file)
@@ -1,10 +1,7 @@
-define( [
-       "../core",
-       "../queue",
-       "../effects" // Delay is optional because of this dependency
-], function( jQuery ) {
+import jQuery from "../core.js";
 
-"use strict";
+import "../queue.js";
+import "../effects.js"; // Delay is optional because of this dependency
 
 // Based off of the plugin by Clint Helfers, with permission.
 // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
@@ -19,6 +16,3 @@ jQuery.fn.delay = function( time, type ) {
                };
        } );
 };
-
-return jQuery.fn.delay;
-} );
index 8033f1115097349bab054d12f5eb3462f2cdedb4..019f25d62b9b2a3e4b9a460c252244ccf28ea71c 100644 (file)
@@ -1,22 +1,17 @@
-define( [
-       "./core",
-       "./core/nodeName",
-       "./var/document",
-       "./var/documentElement",
-       "./var/indexOf",
-       "./var/pop",
-       "./var/push",
-       "./selector/rbuggyQSA",
-       "./selector/support",
-
-       // The following utils are attached directly to the jQuery object.
-       "./selector/contains",
-       "./selector/escapeSelector",
-       "./selector/uniqueSort"
-], function( jQuery, nodeName, document, documentElement, indexOf, pop, push,
-       rbuggyQSA, support ) {
-
-"use strict";
+import jQuery from "./core.js";
+import nodeName from "./core/nodeName.js";
+import document from "./var/document.js";
+import documentElement from "./var/documentElement.js";
+import indexOf from "./var/indexOf.js";
+import pop from "./var/pop.js";
+import push from "./var/push.js";
+import rbuggyQSA from "./selector/rbuggyQSA.js";
+import support from "./selector/support.js";
+
+// The following utils are attached directly to the jQuery object.
+import "./selector/contains.js";
+import "./selector/escapeSelector.js";
+import "./selector/uniqueSort.js";
 
 var preferredDoc = document,
        matches = documentElement.matches || documentElement.msMatchesSelector;
@@ -1642,5 +1637,3 @@ setDocument();
 jQuery.find = find;
 
 } )();
-
-} );
index 0d6273c286b9013d05639c2ef1bc351c6243ee94..a62b97ab5bb4953dd4c08bd1b2f3a07ecf84c16c 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 // Note: an element does not contain itself
 jQuery.contains = function( a, b ) {
@@ -18,5 +14,3 @@ jQuery.contains = function( a, b ) {
                        a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
        ) );
 };
-
-} );
index 1d89c2f00bb9120cf199f3c2487d5b900f96e47f..bc61355fabb7d4562e6f4bf7bf4799e383a73afd 100644 (file)
@@ -1,8 +1,4 @@
-define( [
-       "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
 
 // CSS string/identifier serialization
 // https://drafts.csswg.org/cssom/#common-serializing-idioms
@@ -27,5 +23,3 @@ function fcssescape( ch, asCodePoint ) {
 jQuery.escapeSelector = function( sel ) {
        return ( sel + "" ).replace( rcssescape, fcssescape );
 };
-
-} );
index eee151afbaffaab5d714d1caeefc2669d9cadc8b..f638fc429b3e1aa3c2457d6938bdd2ec60622af9 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../var/document",
-       "../var/isIE"
-], function( document, isIE ) {
-
-"use strict";
+import document from "../var/document.js";
+import isIE from "../var/isIE.js";
 
 var rbuggyQSA = [],
        testEl = document.createElement( "div" );
@@ -25,6 +21,4 @@ if ( isIE ) {
 
 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
 
-return rbuggyQSA;
-
-} );
+export default rbuggyQSA;
index 86cd2d9aeacb9fe4b66c6bc36dce29fa5b84b5fc..cc584bf66c7c8d367950ecf2386205dcb3beb9bf 100644 (file)
@@ -1,9 +1,5 @@
-define( [
-       "../var/document",
-       "../var/support"
-], function( document, support ) {
-
-"use strict";
+import document from "../var/document.js";
+import support from "../var/support.js";
 
 // Support: IE 9 - 11+, Edge 12 - 18+
 // IE/Edge don't support the :scope pseudo-class.
@@ -12,6 +8,4 @@ try {
        support.scope = true;
 } catch ( e ) {}
 
-return support;
-
-} );
+export default support;
index ec97de84935edbb1cff01b6d0572fb9ad18aa1bc..d0bf69198b9df0187b53c95a1378b60bea4124ed 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../core",
-       "../var/document",
-       "../var/sort"
-], function( jQuery, document, sort ) {
-
-"use strict";
+import jQuery from "../core.js";
+import document from "../var/document.js";
+import sort from "../var/sort.js";
 
 var hasDuplicate;
 
@@ -90,5 +86,3 @@ jQuery.uniqueSort = function( results ) {
 
        return results;
 };
-
-} );
index 6743b78e942e8ce3991a7ea9337e3576a6aac3ab..a25097edcf128b80663096fb8e6c738b721aa9ba 100644 (file)
@@ -1,13 +1,10 @@
-define( [
-       "./core",
-       "./core/toType",
-       "./var/rcheckableType",
-       "./core/init",
-       "./traversing", // filter
-       "./attributes/prop"
-], function( jQuery, toType, rcheckableType ) {
+import jQuery from "./core.js";
+import toType from "./core/toType.js";
+import rcheckableType from "./var/rcheckableType.js";
 
-"use strict";
+import "./core/init.js";
+import "./traversing.js"; // filter
+import "./attributes/prop.js";
 
 var
        rbracket = /\[\]$/,
@@ -131,5 +128,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index f71fbe69ea6d8620224d12843e1f67b6541bc0b6..5ce33f3174f966fa8cbfa69627f4cdf67c389e1f 100644 (file)
@@ -1,18 +1,14 @@
-define( [
-       "./core",
-       "./var/getProto",
-       "./var/indexOf",
-       "./traversing/var/dir",
-       "./traversing/var/siblings",
-       "./traversing/var/rneedsContext",
-       "./core/nodeName",
-
-       "./core/init",
-       "./traversing/findFilter",
-       "./selector"
-], function( jQuery, getProto, indexOf, dir, siblings, rneedsContext, nodeName ) {
-
-"use strict";
+import jQuery from "./core.js";
+import getProto from "./var/getProto.js";
+import indexOf from "./var/indexOf.js";
+import dir from "./traversing/var/dir.js";
+import siblings from "./traversing/var/siblings.js";
+import rneedsContext from "./traversing/var/rneedsContext.js";
+import nodeName from "./core/nodeName.js";
+
+import "./core/init.js";
+import "./traversing/findFilter.js";
+import "./selector.js";
 
 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
 
@@ -194,5 +190,4 @@ jQuery.each( {
        };
 } );
 
-return jQuery;
-} );
+export default jQuery;
index 2f526b71381571dbada52e6e7b028a5c86531318..42022180c4070c7a2f26864f54375b7d6d5c097d 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "../core",
-       "../var/indexOf",
-       "./var/rneedsContext",
-       "../selector"
-], function( jQuery, indexOf, rneedsContext ) {
+import jQuery from "../core.js";
+import indexOf from "../var/indexOf.js";
+import rneedsContext from "./var/rneedsContext.js";
 
-"use strict";
+import "../selector.js";
 
 // Implement the identical functionality for filter and not
 function winnow( elements, qualifier, not ) {
@@ -92,5 +89,3 @@ jQuery.fn.extend( {
                ).length;
        }
 } );
-
-} );
index 366a823d691de5a852324e70efe890d17aefb283..b34bfa4d40c66bb83814db6f3196c1952bc79521 100644 (file)
@@ -1,10 +1,6 @@
-define( [
-       "../../core"
-], function( jQuery ) {
+import jQuery from "../../core.js";
 
-"use strict";
-
-return function( elem, dir, until ) {
+export default function( elem, dir, until ) {
        var matched = [],
                truncate = until !== undefined;
 
@@ -18,5 +14,3 @@ return function( elem, dir, until ) {
        }
        return matched;
 };
-
-} );
index d0663cee8a2bcae2c0f19bc751fab82c5ac23b52..9038e17cd83aa3a3069746a286a7322e76528e3b 100644 (file)
@@ -1,8 +1,5 @@
-define( [
-       "../../core",
-       "../../selector"
-], function( jQuery ) {
-       "use strict";
+import jQuery from "../../core.js";
 
-       return jQuery.expr.match.needsContext;
-} );
+import "../../selector.js";
+
+export default jQuery.expr.match.needsContext;
index 952629d0c89cb891c220900ad78b8558585f9f53..910b35a7c42c74656abe3256d9b251bd507548ed 100644 (file)
@@ -1,8 +1,4 @@
-define( function() {
-
-"use strict";
-
-return function( n, elem ) {
+export default function( n, elem ) {
        var matched = [];
 
        for ( ; n; n = n.nextSibling ) {
@@ -13,5 +9,3 @@ return function( n, elem ) {
 
        return matched;
 };
-
-} );
index f9e850fd8eb254718ea3c856dfc459d3a35065f3..c8fdcd989283e637b7c6291e498185d5bc2ee4b6 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./fnToString"
-], function( fnToString ) {
-       "use strict";
+import fnToString from "./fnToString.js";
 
-       return fnToString.call( Object );
-} );
+export default fnToString.call( Object );
index 84713d8380c9066cc705f697c5082e801e85ebb3..d6d1738de67ec12cd1cae1bbef0525681e0f82c7 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return [];
-} );
+export default [];
index 4365d46a26f80438de17a35b891be1e5aba70414..758dff6de1023f9195c20a9176ab4ffcb340cc4a 100644 (file)
@@ -1,6 +1,2 @@
-define( function() {
-       "use strict";
-
-       // [[Class]] -> type pairs
-       return {};
-} );
+// [[Class]] -> type pairs
+export default {};
index dd3939df4f1e879efc3bb9a36a6cea2c75ff4f4c..db89b687533b8babd86b8f0b4f9949cf99df2097 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return window.document;
-} );
+export default window.document;
index 0e3f8b48c8a42b82a50476c320bb0db6206a4be3..4bad20e5483d5e4c62effe8515edaafc7f0070f0 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./document"
-], function( document ) {
-       "use strict";
+import document from "./document.js";
 
-       return document.documentElement;
-} );
+export default document.documentElement;
index 6c7a27169e44c1061b7cfc7affa60df7c38c14ed..1724205528c233533f4739b918e54330698b3123 100644 (file)
@@ -1,15 +1,9 @@
-define( [
-       "./arr"
-], function( arr ) {
-
-"use strict";
+import arr from "./arr.js";
 
 // Support: IE 11+, Edge 18+
 // Provide fallback for browsers without Array#flat.
-return arr.flat ? function( array ) {
+export default arr.flat ? function( array ) {
        return arr.flat.call( array );
 } : function( array ) {
        return arr.concat.apply( [], array );
 };
-
-} );
index 18c43ff3017ab2f4b96181c7146d47c23f2fc7bd..10042138ee41c38a3587e6a4099a0857d6f92b9d 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./hasOwn"
-], function( hasOwn ) {
-       "use strict";
+import hasOwn from "./hasOwn.js";
 
-       return hasOwn.toString;
-} );
+export default hasOwn.toString;
index 965fab8fb4b98b67bc3502589fe016932a2f331e..392cd3973c07bcdeff88685179d860950e92e01a 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return Object.getPrototypeOf;
-} );
+export default Object.getPrototypeOf;
index 44ab6807d8b84b0a30952a28033ad7d771762f9f..62f2c1852385f08f25647d622453fa8921ec2071 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./class2type"
-], function( class2type ) {
-       "use strict";
+import class2type from "./class2type.js";
 
-       return class2type.hasOwnProperty;
-} );
+export default class2type.hasOwnProperty;
index 8320b98e57f4908f774741b175d6e3cebd6eeda9..f1342c8f7cacb0ee02e486c943387ee08ddaa303 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./arr"
-], function( arr ) {
-       "use strict";
+import arr from "./arr.js";
 
-       return arr.indexOf;
-} );
+export default arr.indexOf;
index e6a37cb5a7f387f4bc92a3c7a30405ce940435bf..a239745ea724ad54f94243122670edd027b1d490 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./document"
-], function( document ) {
-       "use strict";
+import document from "./document.js";
 
-       return document.documentMode;
-} );
+export default document.documentMode;
index 2ba1168dd383602785afee2c11f8ab39e7cdba59..fa64581eeb740413b7564c14e48cafca232883ff 100644 (file)
@@ -1,8 +1,3 @@
-define( function() {
-       "use strict";
-
-       return function isWindow( obj ) {
-               return obj != null && obj === obj.window;
-       };
-
-} );
+export default function isWindow( obj ) {
+       return obj != null && obj === obj.window;
+};
index 6f06d73b17e939e74b25c33537b02e9eaaba0c39..5f6bca473b669dce9130a73d6f55084820e13a70 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
-} );
+export default ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
index 6f1eb903c9960f9c1d07f1e90755b03003a89e17..b1c9131c512bf1188153be20ae29ac4f1a86836f 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./arr"
-], function( arr ) {
-       "use strict";
+import arr from "./arr.js";
 
-       return arr.pop;
-} );
+export default arr.pop;
index 94656209ab372bdd960dd609f54ff673e454be7a..2758aa58792eacde10896083222472e93d46459f 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./arr"
-], function( arr ) {
-       "use strict";
+import arr from "./arr.js";
 
-       return arr.push;
-} );
+export default arr.push;
index 25bbcb418843796377012c1b2ec2fefc30cc3d02..9fc4b55dc2044055e673eac2a31953d17be0ad24 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return ( /^(?:checkbox|radio)$/i );
-} );
+export default ( /^(?:checkbox|radio)$/i );
index 4214b14aa5cacff8d534c8d852cd4c0f4a3632fa..c96eb65cab5a3bc2c99160dfd62ce109cf65b754 100644 (file)
@@ -1,9 +1,3 @@
-define( [
-       "../var/pnum"
-], function( pnum ) {
+import pnum from "../var/pnum.js";
 
-"use strict";
-
-return new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
-
-} );
+export default new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
index 29eebf287e2af0725daa5154c0f666aab8223d3e..db2a9e360f5217c040775cc8afa542715db0a141 100644 (file)
@@ -1,8 +1,4 @@
-define( function() {
-       "use strict";
-
-       // Only count HTML whitespace
-       // Other whitespace should count in values
-       // https://infra.spec.whatwg.org/#ascii-whitespace
-       return ( /[^\x20\t\r\n\f]+/g );
-} );
+// Only count HTML whitespace
+// Other whitespace should count in values
+// https://infra.spec.whatwg.org/#ascii-whitespace
+export default ( /[^\x20\t\r\n\f]+/g );
index 915f837be4726da765ada77a1dc0d7a450db7764..4d767ac98ab0765588107c658bbda68708bf1eeb 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./arr"
-], function( arr ) {
-       "use strict";
+import arr from "./arr.js";
 
-       return arr.slice;
-} );
+export default arr.slice;
index a943fa77caa0372c09da435c649db0358cdc8347..031be77061f431d7247f199cbcdd5d0571156c49 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./arr"
-], function( arr ) {
-       "use strict";
+import arr from "./arr.js";
 
-       return arr.sort;
-} );
+export default arr.sort;
index 094d0aece05d56c1491e0a2c941f04e4e17dd844..cc0a15d15c708f71e677c6a4db16b723bcddd3a0 100644 (file)
@@ -1,6 +1,2 @@
-define( function() {
-       "use strict";
-
-       // All support tests are defined in their respective modules.
-       return {};
-} );
+// All support tests are defined in their respective modules.
+export default {};
index ff4ecdc722268c141e147c02f5b16e7afd93e5ea..01682d601062ec02f9a883abd0f85c4960bf922b 100644 (file)
@@ -1,7 +1,3 @@
-define( [
-       "./class2type"
-], function( class2type ) {
-       "use strict";
+import class2type from "./class2type.js";
 
-       return class2type.toString;
-} );
+export default class2type.toString;
index a5e75af36e67472841de43556e27c48c68c1cc92..77d925fb046ed5eacc34439c7e6fa4a24f4c3941 100644 (file)
@@ -1,5 +1 @@
-define( function() {
-       "use strict";
-
-       return "".trim;
-} );
+export default "".trim;
index a42c04da75df036baf9db2de8590b62368c3fcd1..cd7636b8dba11cbbbd3a550e7bbc7f068b3d6814 100644 (file)
@@ -1,11 +1,8 @@
-define( [
-       "./core",
-       "./core/init",
-       "./manipulation", // clone
-       "./traversing" // parent, contents
-], function( jQuery ) {
+import jQuery from "./core.js";
 
-"use strict";
+import "./core/init.js";
+import "./manipulation.js"; // clone
+import "./traversing.js"; // parent, contents
 
 jQuery.fn.extend( {
        wrapAll: function( html ) {
@@ -73,5 +70,4 @@ jQuery.fn.extend( {
        }
 } );
 
-return jQuery;
-} );
+export default jQuery;
index dfbd9a028737a9b4a3e79ddfb9c124c43c19bb13..22ddbf8126e595e431333e83e5a6b88217a7e43e 100644 (file)
@@ -1,4 +1,3 @@
-/* eslint-disable no-unused-vars*/
 /*!
  * jQuery JavaScript Library v@VERSION
  * https://jquery.com/
index a6d8fc872efdd2e616b425766172a54114b49b78..f5a3fa591f8a39d64374e59bfe3ffbde8de8f3db 100644 (file)
                        "parserOptions": {
                                "ecmaVersion": 2015
                        }
+               },
+
+               {
+                       "files": [
+                               "jquery.js",
+                               "data/testinit.js"
+                       ],
+                       "parserOptions": {
+                               "ecmaVersion": 2020
+                       }
                }
        ]
 }
index a597ccb3554dac7b00e8ee221fec268dfe7a318f..7a8697189ed378376e59f2f90560496301cd4a91 100644 (file)
@@ -300,7 +300,7 @@ QUnit.testUnlessIE = QUnit.isIE ? QUnit.skip : QUnit.test;
 this.loadTests = function() {
 
        // Directly load tests that need synchronous evaluation
-       if ( !QUnit.urlParams.amd || document.readyState === "loading" ) {
+       if ( !QUnit.urlParams.esmodules || document.readyState === "loading" ) {
                document.write( "<script src='" + parentUrl + "test/unit/ready.js'><\x2Fscript>" );
        } else {
                QUnit.module( "ready", function() {
index 7e5d8aa01f35127db3a9bf249cfd16b807d18b8a..632275bb3b9a80e3ee4da3650def9d679e956515 100644 (file)
@@ -19,7 +19,7 @@
        <!-- See testinit for the list of tests -->
        <script src="data/testinit.js"></script>
 
-       <!-- A script that includes jQuery min, dev, or AMD -->
+       <!-- A script that includes jQuery min, dev, or ES modules -->
        <!-- Adds "basic" URL option, even to iframes -->
        <!-- iframes will not load AMD as loading needs to be synchronous for some tests -->
        <!-- Also executes the function above to load tests -->
@@ -29,7 +29,7 @@
                // Load tests if they have not been loaded
                // This is in a different script tag to ensure that
                // jQuery is on the page when the testrunner executes
-               if ( !QUnit.urlParams.amd ) {
+               if ( !QUnit.urlParams.esmodules ) {
                        loadTests();
                }
        </script>
index 6b1aef42f6c8bda2f0435900ce9613a1d149b515..d6d53fb26334adac1558512dd296b1eff8d6c030 100644 (file)
@@ -2,7 +2,8 @@
 ( function() {
        /* global loadTests: false */
 
-       var FILEPATH = "/test/jquery.js",
+       var dynamicImportSource,
+               FILEPATH = "/test/jquery.js",
                activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
                parentUrl = activeScript && activeScript.src ?
                        activeScript.src.replace( /[?#].*/, "" ) + FILEPATH.replace( /[^/]+/g, ".." ) + "/" :
        // Define configuration parameters controlling how jQuery is loaded
        if ( QUnit ) {
 
-               // AMD loading is asynchronous and incompatible with synchronous test loading in Karma
+               // ES modules loading is asynchronous and incompatible with synchronous
+               // test loading in Karma.
                if ( !window.__karma__ ) {
                        QUnit.config.urlConfig.push( {
-                               id: "amd",
-                               label: "Load with AMD",
-                               tooltip: "Load the AMD jQuery file (and its dependencies)"
+                               id: "esmodules",
+                               label: "Load as modules",
+                               tooltip: "Load a relevant jQuery module file (and its dependencies)"
                        } );
                }
 
 
        // Honor AMD loading on the main window (detected by seeing QUnit on it).
        // This doesn't apply to iframes because they synchronously expect jQuery to be there.
-       if ( urlParams.amd && window.QUnit ) {
-               require.config( {
-                       baseUrl: parentUrl
-               } );
-               src = "src/jquery";
+       if ( urlParams.esmodules && window.QUnit ) {
 
-               // Include tests if specified
-               if ( typeof loadTests !== "undefined" ) {
-                       require( [ src ], loadTests );
-               } else {
-                       require( [ src ] );
-               }
+               // Support: IE 11+, Edge 12 - 18+
+               // IE/Edge don't support the dynamic import syntax so they'd crash
+               // with a SyntaxError here.
+               dynamicImportSource = "" +
+                       "import( `${ parentUrl }src/jquery.js` ).then( ( { default: jQuery } ) => {\n" +
+                       "       window.jQuery = jQuery;\n" +
+                       "       if ( typeof loadTests === \"function\" ) {\n" +
+                       "               // Include tests if specified\n" +
+                       "               loadTests();\n" +
+                       "       }\n" +
+                       "} );";
+
+               eval( dynamicImportSource );
 
        // Otherwise, load synchronously
        } else {