"env": {},
"globals": {
- "window": true,
- "define": true,
- "module": true
+ "window": true
},
"rules": {
"extends": "jquery",
"parserOptions": {
- "ecmaVersion": 2017
+ "ecmaVersion": 2018
},
"env": {
{
"root": true,
- "extends": "./.eslintrc-node.json"
+ "extends": "./.eslintrc-node.json",
+
+ "overrides": [
+ {
+ "files": "rollup.config.js",
+ "parserOptions": {
+ "sourceType": "module"
+ }
+ }
+ ]
}
$ 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.
"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)",
/**
- * 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
* @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;
}
}
} );
}
- },
+ };
/**
* Adds the specified module to the excluded or included list, depending on the flag
* 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 ) {
// 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 );
}
if ( additional ) {
excludeList( additional.remove || additional );
if ( additional.include ) {
- included = included.concat( additional.include );
+ included.push( ...additional.include );
grunt.log.writeln( "+" + additional.include );
}
}
}
};
- // 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
//
// 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, "+" );
// Track individuals
tracks.forEach( function( module ) {
- var path = defaultPath.concat( [ "individual" ], module );
+ const path = defaultPath.concat( [ "individual" ], module );
insight.track.apply( insight, path );
} );
"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
}
}
"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",
"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",
"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
}
}
]
-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,
// 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)
};
} );
-return jQuery;
-} );
+export default jQuery;
-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 = /(=)\?(?=&|$)|\?\?/;
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;
}
return "script";
}
} );
-
-} );
-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
return this;
};
-
-} );
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
return xml;
};
-return jQuery.parseXML;
-
-} );
+export default jQuery.parseXML;
-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 ) {
};
}
} );
-
-} );
-define( function() {
- "use strict";
-
- return window.location;
-} );
+export default window.location;
-define( function() {
- "use strict";
-
- return Date.now();
-} );
+export default { guid: Date.now() };
-define( function() {
- "use strict";
-
- return ( /\?/ );
-} );
+export default ( /\?/ );
-define( [
- "../core",
- "../ajax"
-], function( jQuery ) {
+import jQuery from "../core.js";
-"use strict";
+import "../ajax.js";
jQuery.ajaxSettings.xhr = function() {
return new window.XMLHttpRequest();
}
};
} );
-
-} );
-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;
-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 ) {
}
};
} );
-
-} );
-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" ) || "";
return false;
}
} );
-
-} );
-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;
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
} );
-
-} );
-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;
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
}
};
} );
-
-} );
-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 ) {
return self;
};
-return jQuery;
-} );
+export default jQuery;
-/* 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,
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
-return jQuery;
-} );
+export default jQuery;
-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;
-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
return len ? fn( elems[ 0 ], key ) : emptyGet;
};
-return access;
-
-} );
+export default access;
-define( [], function() {
-
-"use strict";
-
// Matches dashed string for camelizing
var rdashAlpha = /-([a-z])/g;
return string.replace( rdashAlpha, fcamelCase );
}
-return camelCase;
-
-} );
+export default camelCase;
// 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,
// Initialize central reference
rootjQuery = jQuery( document );
-return init;
-
-} );
+export default init;
-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;
-define( function() {
-
-"use strict";
-
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
-return nodeName;
-
-} );
+export default nodeName;
-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,
return jQuery.merge( [], parsed.childNodes );
};
-
-return jQuery.parseHTML;
-
-} );
-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 ) {
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
-
-} );
-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();
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
-
-} );
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
jQuery.readyException = function( error ) {
window.setTimeout( function() {
throw error;
} );
};
-
-} );
-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;
-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 ) {
typeof obj;
}
-return toType;
-} );
+export default toType;
-define( function() {
-
-"use strict";
-
-return ( /HTML$/i );
-
-} );
+export default ( /HTML$/i );
-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 );
-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
}
} );
-return jQuery;
-} );
+export default jQuery;
-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,
return adjusted;
}
-return adjustCSS;
-} );
+export default adjustCSS;
-define( [
- "../core/camelCase"
-], function( camelCase ) {
-
-"use strict";
+import camelCase from "../core/camelCase.js";
// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/;
return camelCase( string.replace( rmsPrefix, "ms-" ) );
}
-return cssCamelCase;
-
-} );
+export default cssCamelCase;
-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;
ret;
}
-return curCSS;
-} );
+export default curCSS;
-define( [
- "../var/document"
-], function( document ) {
-
-"use strict";
+import document from "../var/document.js";
var cssPrefixes = [ "Webkit", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style,
return vendorProps[ name ] = vendorPropName( name ) || name;
}
-return finalPropName;
-
-} );
+export default finalPropName;
-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 );
jQuery.expr.pseudos.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};
-
-} );
-define( function() {
-
-"use strict";
-
var ralphaStart = /^[a-z]/,
// The regex visualized:
rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
};
-return isAutoPx;
-
-} );
+export default isAutoPx;
-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 = {};
}
} );
-return showHide;
-} );
+export default showHide;
-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;
return reliableTrDimensionsVal;
};
-return support;
-
-} );
+export default support;
-define( function() {
- "use strict";
-
- return [ "Top", "Right", "Bottom", "Left" ];
-} );
+export default [ "Top", "Right", "Bottom", "Left" ];
-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 );
+};
-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";
+};
-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" );
-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 = {};
return ret;
};
-
-} );
-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
//
}
} );
-return jQuery;
-} );
+export default jQuery;
-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++;
}
};
-return Data;
-} );
+export default Data;
-define( function() {
-
-"use strict";
-
/**
* Determines whether an object can have data
*/
-return function( owner ) {
+export default function( owner ) {
// Accepts only:
// - Node
// - Any
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
-
-} );
-define( [
- "../Data"
-], function( Data ) {
- "use strict";
+import Data from "../Data.js";
- return new Data();
-} );
+export default new Data();
-define( [
- "../Data"
-], function( Data ) {
- "use strict";
+import Data from "../Data.js";
- return new Data();
-} );
+export default new Data();
-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;
}
} );
-return jQuery;
-} );
+export default jQuery;
-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.
);
}
};
-
-} );
-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( {
jQuery.trim = function( text ) {
return text == null ? "" : trim.call( text );
};
-} );
-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 ) {
} );
} );
-return jQuery;
-} );
+export default jQuery;
-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,
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 ] );
_default: 400
};
-return jQuery;
-} );
+export default jQuery;
-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 );
// Back compat <1.8 extension point
jQuery.fx.step = {};
-
-} );
-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;
};
-
-} );
-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/,
}
} );
-return jQuery;
-} );
+export default jQuery;
-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( [
return this.on( type, fn );
};
} );
-
-} );
-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 " +
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
} );
-
-} );
-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 ) {
}
} );
-return jQuery;
-} );
+export default jQuery;
-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
return jQuery;
} );
}
-
-} );
-define( [
- "../core"
-], function( jQuery, noGlobal ) {
-
-"use strict";
+import jQuery from "../core.js";
var
// 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;
}
-
-} );
-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;
-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
};
} );
-return jQuery;
-} );
+export default jQuery;
-define( [
- "../ajax"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../ajax.js";
jQuery._evalUrl = function( url, options ) {
return jQuery.ajax( {
} );
};
-return jQuery._evalUrl;
-
-} );
+export default jQuery._evalUrl;
-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+;/;
return fragment;
}
-return buildFragment;
-} );
+export default buildFragment;
-define( [
- "../core",
- "../core/nodeName"
-], function( jQuery, nodeName ) {
-
-"use strict";
+import jQuery from "../core.js";
+import nodeName from "../core/nodeName.js";
function getAll( context, tag ) {
return ret;
}
-return getAll;
-} );
+export default getAll;
-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 ) {
}
}
-return setGlobalEval;
-} );
+export default setGlobalEval;
-define( function() {
- "use strict";
-
- return ( /^$|^module$|\/(?:java|ecma)script/i );
-} );
+export default ( /^$|^module$|\/(?:java|ecma)script/i );
-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 );
-define( function() {
-
-"use strict";
-
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
-return wrapMap;
-} );
+export default wrapMap;
-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 ) {
};
} );
-return jQuery;
-} );
+export default jQuery;
-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 ) {
}
} );
-return jQuery;
-} );
+export default jQuery;
-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/
};
} );
};
-
-return jQuery.fn.delay;
-} );
-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;
jQuery.find = find;
} )();
-
-} );
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
// Note: an element does not contain itself
jQuery.contains = function( a, b ) {
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
) );
};
-
-} );
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
+import jQuery from "../core.js";
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
jQuery.escapeSelector = function( sel ) {
return ( sel + "" ).replace( rcssescape, fcssescape );
};
-
-} );
-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" );
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
-return rbuggyQSA;
-
-} );
+export default rbuggyQSA;
-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.
support.scope = true;
} catch ( e ) {}
-return support;
-
-} );
+export default support;
-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;
return results;
};
-
-} );
-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 = /\[\]$/,
}
} );
-return jQuery;
-} );
+export default jQuery;
-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))/,
};
} );
-return jQuery;
-} );
+export default jQuery;
-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 ) {
).length;
}
} );
-
-} );
-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;
}
return matched;
};
-
-} );
-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;
-define( function() {
-
-"use strict";
-
-return function( n, elem ) {
+export default function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
return matched;
};
-
-} );
-define( [
- "./fnToString"
-], function( fnToString ) {
- "use strict";
+import fnToString from "./fnToString.js";
- return fnToString.call( Object );
-} );
+export default fnToString.call( Object );
-define( function() {
- "use strict";
-
- return [];
-} );
+export default [];
-define( function() {
- "use strict";
-
- // [[Class]] -> type pairs
- return {};
-} );
+// [[Class]] -> type pairs
+export default {};
-define( function() {
- "use strict";
-
- return window.document;
-} );
+export default window.document;
-define( [
- "./document"
-], function( document ) {
- "use strict";
+import document from "./document.js";
- return document.documentElement;
-} );
+export default document.documentElement;
-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 );
};
-
-} );
-define( [
- "./hasOwn"
-], function( hasOwn ) {
- "use strict";
+import hasOwn from "./hasOwn.js";
- return hasOwn.toString;
-} );
+export default hasOwn.toString;
-define( function() {
- "use strict";
-
- return Object.getPrototypeOf;
-} );
+export default Object.getPrototypeOf;
-define( [
- "./class2type"
-], function( class2type ) {
- "use strict";
+import class2type from "./class2type.js";
- return class2type.hasOwnProperty;
-} );
+export default class2type.hasOwnProperty;
-define( [
- "./arr"
-], function( arr ) {
- "use strict";
+import arr from "./arr.js";
- return arr.indexOf;
-} );
+export default arr.indexOf;
-define( [
- "./document"
-], function( document ) {
- "use strict";
+import document from "./document.js";
- return document.documentMode;
-} );
+export default document.documentMode;
-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;
+};
-define( function() {
- "use strict";
-
- return ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
-} );
+export default ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
-define( [
- "./arr"
-], function( arr ) {
- "use strict";
+import arr from "./arr.js";
- return arr.pop;
-} );
+export default arr.pop;
-define( [
- "./arr"
-], function( arr ) {
- "use strict";
+import arr from "./arr.js";
- return arr.push;
-} );
+export default arr.push;
-define( function() {
- "use strict";
-
- return ( /^(?:checkbox|radio)$/i );
-} );
+export default ( /^(?:checkbox|radio)$/i );
-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" );
-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 );
-define( [
- "./arr"
-], function( arr ) {
- "use strict";
+import arr from "./arr.js";
- return arr.slice;
-} );
+export default arr.slice;
-define( [
- "./arr"
-], function( arr ) {
- "use strict";
+import arr from "./arr.js";
- return arr.sort;
-} );
+export default arr.sort;
-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 {};
-define( [
- "./class2type"
-], function( class2type ) {
- "use strict";
+import class2type from "./class2type.js";
- return class2type.toString;
-} );
+export default class2type.toString;
-define( function() {
- "use strict";
-
- return "".trim;
-} );
+export default "".trim;
-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 ) {
}
} );
-return jQuery;
-} );
+export default jQuery;
-/* eslint-disable no-unused-vars*/
/*!
* jQuery JavaScript Library v@VERSION
* https://jquery.com/
"parserOptions": {
"ecmaVersion": 2015
}
+ },
+
+ {
+ "files": [
+ "jquery.js",
+ "data/testinit.js"
+ ],
+ "parserOptions": {
+ "ecmaVersion": 2020
+ }
}
]
}
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() {
<!-- 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 -->
// 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>
( 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 {