mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Core: Migrate from AMD to ES modules 🎉
Migrate all source AMD modules to ECMAScript modules. The final bundle is compiled by a custom build process that uses Rollup under the hood. Test files themselves are still loaded via RequireJS as that has to work in IE 11. Tests can now be run in "Load as modules" mode which replaces the previous "Load with AMD" option. That option of running tests doesn't work in IE and Edge as it requires support for dynamic imports. Some of the changes required by the migration: * check `typeof` of `noGlobal` instead of using the variable directly as it's not available when modules are used * change the nonce module to be an object as ECMASscript module exports are immutable * remove some unused exports * import `./core/parseHTML.js` directly in `jquery.js` so that it's not being cut out when the `ajax` module is excluded in a custom compilation Closes gh-4541
This commit is contained in:
parent
a612733be0
commit
d0ce00cdfa
@ -15,9 +15,7 @@
|
||||
"env": {},
|
||||
|
||||
"globals": {
|
||||
"window": true,
|
||||
"define": true,
|
||||
"module": true
|
||||
"window": true
|
||||
},
|
||||
|
||||
"rules": {
|
||||
|
@ -4,7 +4,7 @@
|
||||
"extends": "jquery",
|
||||
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
|
||||
"env": {
|
||||
|
@ -1,5 +1,14 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "./.eslintrc-node.json"
|
||||
"extends": "./.eslintrc-node.json",
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "rollup.config.js",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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)",
|
||||
|
@ -1,132 +1,66 @@
|
||||
/**
|
||||
* 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 );
|
||||
},
|
||||
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.
|
||||
wrapper = read( "wrapper.js" ).split( /[\x20\t]*\/\/ @CODE\n(?:[\x20\t]*\/\/[^\n]+\n)*/ ),
|
||||
const 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
|
||||
const inputFileName = "jquery.js";
|
||||
const inputRollupOptions = {
|
||||
input: `${ srcFolder }/${ inputFileName }`
|
||||
};
|
||||
const outputRollupOptions = {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
// 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",
|
||||
|
||||
// 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;
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
@ -220,7 +158,7 @@ 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;
|
||||
name = name ? `dist/${ name }` : this.data.dest;
|
||||
|
||||
// append commit id to version
|
||||
if ( process.env.COMMIT ) {
|
||||
@ -246,13 +184,34 @@ module.exports = function( grunt ) {
|
||||
excluder( flag );
|
||||
}
|
||||
|
||||
// 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 ) {
|
||||
config.rawText[ "exports/global" ] = "define(['../core']," +
|
||||
"function( jQuery ) {\njQuery.noConflict = function() {};\n});";
|
||||
rollupHypotheticalOptions.files[ `${ srcFolder }/exports/global.js` ] =
|
||||
"import jQuery from \"../core.js\";\n\n" +
|
||||
"jQuery.noConflict = function() {};";
|
||||
excluded.splice( index, 1 );
|
||||
}
|
||||
|
||||
// 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" );
|
||||
}
|
||||
|
||||
// Remove the comma for anonymous defines
|
||||
rollupHypotheticalOptions.files[ `${ srcFolder }/exports/amd.js` ] =
|
||||
read( "exports/amd.js" )
|
||||
.replace( /(\s*)"jquery"(\,\s*)/, amdName ? "$1\"" + amdName + "\"$2" : "" );
|
||||
}
|
||||
|
||||
grunt.verbose.writeflags( excluded, "Excluded" );
|
||||
grunt.verbose.writeflags( included, "Included" );
|
||||
|
||||
@ -264,46 +223,54 @@ module.exports = function( grunt ) {
|
||||
grunt.config.set( "pkg.version", version );
|
||||
grunt.verbose.writeln( "Version changed to " + version );
|
||||
|
||||
// Have to use shallow or core will get excluded since it is a dependency
|
||||
config.excludeShallow = excluded;
|
||||
// Replace excluded modules with empty sources.
|
||||
for ( const module of excluded ) {
|
||||
rollupHypotheticalOptions.files[ `${ srcFolder }/${ module }.js` ] = "";
|
||||
}
|
||||
}
|
||||
config.include = included;
|
||||
|
||||
/**
|
||||
* Handle Final output from the optimizer
|
||||
* @param {String} compiled
|
||||
*/
|
||||
config.out = function( compiled ) {
|
||||
compiled = compiled
|
||||
// Turn off opt-in if necessary
|
||||
if ( !optIn ) {
|
||||
|
||||
// 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" ) );
|
||||
.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( "," ) : "" ) +
|
||||
"]);";
|
||||
}
|
||||
|
||||
// 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( {
|
||||
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 );
|
||||
} );
|
||||
|
11
dist/.eslintrc.json
vendored
11
dist/.eslintrc.json
vendored
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
"jQuery": false,
|
||||
"module": true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"files": "exports/amd.js",
|
||||
"globals": {
|
||||
"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
|
||||
}
|
||||
}
|
||||
]
|
||||
|
32
src/ajax.js
32
src/ajax.js
@ -1,19 +1,15 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./var/document",
|
||||
"./var/rnothtmlwhite",
|
||||
"./ajax/var/location",
|
||||
"./ajax/var/nonce",
|
||||
"./ajax/var/rquery",
|
||||
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";
|
||||
|
||||
"./core/init",
|
||||
"./ajax/parseXML",
|
||||
"./event/trigger",
|
||||
"./deferred",
|
||||
"./serialize" // jQuery.param
|
||||
], function( jQuery, document, rnothtmlwhite, location, nonce, rquery ) {
|
||||
|
||||
"use strict";
|
||||
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;
|
||||
|
@ -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";
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -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 ) {
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return window.location;
|
||||
} );
|
||||
export default window.location;
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return Date.now();
|
||||
} );
|
||||
export default { guid: Date.now() };
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return ( /\?/ );
|
||||
} );
|
||||
export default ( /\?/ );
|
||||
|
@ -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 ) {
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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() {
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
45
src/core.js
45
src/core.js
@ -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;
|
||||
|
@ -1,7 +1,4 @@
|
||||
define( [
|
||||
"../var/document"
|
||||
], function( document ) {
|
||||
"use strict";
|
||||
import document from "../var/document.js";
|
||||
|
||||
var preservedScriptAttributes = {
|
||||
type: true,
|
||||
@ -39,5 +36,4 @@ define( [
|
||||
doc.head.appendChild( script ).parentNode.removeChild( script );
|
||||
}
|
||||
|
||||
return DOMEval;
|
||||
} );
|
||||
export default DOMEval;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,9 +1,7 @@
|
||||
define( [
|
||||
"../core",
|
||||
"../var/documentElement",
|
||||
"../selector/contains" // jQuery.contains
|
||||
], function( jQuery, documentElement ) {
|
||||
"use strict";
|
||||
import jQuery from "../core.js";
|
||||
import documentElement from "../var/documentElement.js";
|
||||
|
||||
import "../selector/contains.js"; // jQuery.contains
|
||||
|
||||
var isAttached = function( elem ) {
|
||||
return jQuery.contains( elem.ownerDocument, elem );
|
||||
@ -19,5 +17,4 @@ define( [
|
||||
};
|
||||
}
|
||||
|
||||
return isAttached;
|
||||
} );
|
||||
export default isAttached;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
} );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
} );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
} );
|
||||
|
@ -1,13 +1,7 @@
|
||||
define( [
|
||||
"../core"
|
||||
], function( jQuery ) {
|
||||
|
||||
"use strict";
|
||||
import jQuery from "../core.js";
|
||||
|
||||
jQuery.readyException = function( error ) {
|
||||
window.setTimeout( function() {
|
||||
throw error;
|
||||
} );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -1,7 +1,4 @@
|
||||
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
|
||||
@ -10,5 +7,4 @@ define( [
|
||||
return tokens.join( " " );
|
||||
}
|
||||
|
||||
return stripAndCollapse;
|
||||
} );
|
||||
export default stripAndCollapse;
|
||||
|
@ -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;
|
||||
|
@ -1,7 +1 @@
|
||||
define( function() {
|
||||
|
||||
"use strict";
|
||||
|
||||
return ( /HTML$/i );
|
||||
|
||||
} );
|
||||
export default ( /HTML$/i );
|
||||
|
@ -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 );
|
||||
} );
|
||||
export default ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
|
||||
|
44
src/css.js
44
src/css.js
@ -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",
|
||||
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";
|
||||
|
||||
"./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 "./core/init.js";
|
||||
import "./core/ready.js";
|
||||
import "./selector.js"; // contains
|
||||
|
||||
var
|
||||
|
||||
@ -426,5 +421,4 @@ jQuery.fn.extend( {
|
||||
}
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
export default jQuery;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return [ "Top", "Right", "Bottom", "Left" ];
|
||||
} );
|
||||
export default [ "Top", "Right", "Bottom", "Left" ];
|
||||
|
@ -1,7 +1,4 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return function( elem ) {
|
||||
export default function( elem ) {
|
||||
|
||||
// Support: IE <=11+ (trac-14150)
|
||||
// In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
|
||||
@ -16,4 +13,3 @@ define( function() {
|
||||
|
||||
return view.getComputedStyle( elem );
|
||||
};
|
||||
} );
|
||||
|
@ -1,9 +1,4 @@
|
||||
define( [
|
||||
"../../core"
|
||||
|
||||
// css is assumed
|
||||
], function( jQuery ) {
|
||||
"use strict";
|
||||
import jQuery from "../../core.js";
|
||||
|
||||
// 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.
|
||||
@ -12,7 +7,7 @@ define( [
|
||||
// * 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 ) {
|
||||
export default function( elem, el ) {
|
||||
|
||||
// isHiddenWithinTree might be called from jQuery#filter function;
|
||||
// in that case, element will be second argument
|
||||
@ -23,4 +18,3 @@ define( [
|
||||
elem.style.display === "" &&
|
||||
jQuery.css( elem, "display" ) === "none";
|
||||
};
|
||||
} );
|
||||
|
@ -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" );
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
17
src/data.js
17
src/data.js
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -1,7 +1,3 @@
|
||||
define( [
|
||||
"../Data"
|
||||
], function( Data ) {
|
||||
"use strict";
|
||||
import Data from "../Data.js";
|
||||
|
||||
return new Data();
|
||||
} );
|
||||
export default new Data();
|
||||
|
@ -1,7 +1,3 @@
|
||||
define( [
|
||||
"../Data"
|
||||
], function( Data ) {
|
||||
"use strict";
|
||||
import Data from "../Data.js";
|
||||
|
||||
return new Data();
|
||||
} );
|
||||
export default new Data();
|
||||
|
@ -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;
|
||||
|
@ -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 ) {
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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 );
|
||||
};
|
||||
} );
|
||||
|
@ -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;
|
||||
|
47
src/effects.js
vendored
47
src/effects.js
vendored
@ -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",
|
||||
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";
|
||||
|
||||
"./core/init",
|
||||
"./queue",
|
||||
"./deferred",
|
||||
"./traversing",
|
||||
"./manipulation",
|
||||
"./css",
|
||||
"./effects/Tween"
|
||||
], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand,
|
||||
isHiddenWithinTree, adjustCSS, cssCamelCase, dataPriv, showHide ) {
|
||||
|
||||
"use strict";
|
||||
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;
|
||||
|
@ -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 = {};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
28
src/event.js
28
src/event.js
@ -1,19 +1,14 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./var/document",
|
||||
"./var/documentElement",
|
||||
"./var/rnothtmlwhite",
|
||||
"./var/rcheckableType",
|
||||
"./var/slice",
|
||||
"./data/var/dataPriv",
|
||||
"./core/nodeName",
|
||||
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";
|
||||
|
||||
"./core/init",
|
||||
"./selector"
|
||||
], function( jQuery, document, documentElement, rnothtmlwhite,
|
||||
rcheckableType, slice, dataPriv, nodeName ) {
|
||||
|
||||
"use strict";
|
||||
import "./core/init.js";
|
||||
import "./selector.js";
|
||||
|
||||
var
|
||||
rkeyEvent = /^key/,
|
||||
@ -857,5 +852,4 @@ jQuery.fn.extend( {
|
||||
}
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
export default jQuery;
|
||||
|
@ -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 );
|
||||
};
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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 );
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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 ) {
|
||||
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";
|
||||
|
||||
"use strict";
|
||||
import "../event.js";
|
||||
|
||||
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
||||
stopPropagationCallback = function( e ) {
|
||||
@ -194,5 +191,4 @@ jQuery.fn.extend( {
|
||||
}
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
export default jQuery;
|
||||
|
@ -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;
|
||||
} );
|
||||
}
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
} );
|
||||
|
70
src/jquery.js
vendored
70
src/jquery.js
vendored
@ -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;
|
||||
|
@ -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",
|
||||
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";
|
||||
|
||||
"./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 "./core/init.js";
|
||||
import "./traversing.js";
|
||||
import "./selector.js";
|
||||
import "./event.js";
|
||||
|
||||
var
|
||||
|
||||
@ -458,5 +451,4 @@ jQuery.each( {
|
||||
};
|
||||
} );
|
||||
|
||||
return jQuery;
|
||||
} );
|
||||
export default jQuery;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return ( /^$|^module$|\/(?:java|ecma)script/i );
|
||||
} );
|
||||
export default ( /^$|^module$|\/(?:java|ecma)script/i );
|
||||
|
@ -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 );
|
||||
} );
|
||||
export default ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
|
||||
|
@ -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;
|
||||
|
@ -1,14 +1,11 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./core/access",
|
||||
"./var/documentElement",
|
||||
"./var/isWindow",
|
||||
"./core/init",
|
||||
"./css",
|
||||
"./selector" // contains
|
||||
], function( jQuery, access, documentElement, isWindow ) {
|
||||
import jQuery from "./core.js";
|
||||
import access from "./core/access.js";
|
||||
import documentElement from "./var/documentElement.js";
|
||||
import isWindow from "./var/isWindow.js";
|
||||
|
||||
"use strict";
|
||||
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;
|
||||
|
14
src/queue.js
14
src/queue.js
@ -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;
|
||||
|
@ -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;
|
||||
} );
|
||||
|
@ -1,22 +1,17 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./core/nodeName",
|
||||
"./var/document",
|
||||
"./var/documentElement",
|
||||
"./var/indexOf",
|
||||
"./var/pop",
|
||||
"./var/push",
|
||||
"./selector/rbuggyQSA",
|
||||
"./selector/support",
|
||||
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.
|
||||
"./selector/contains",
|
||||
"./selector/escapeSelector",
|
||||
"./selector/uniqueSort"
|
||||
], function( jQuery, nodeName, document, documentElement, indexOf, pop, push,
|
||||
rbuggyQSA, support ) {
|
||||
|
||||
"use strict";
|
||||
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;
|
||||
|
||||
} )();
|
||||
|
||||
} );
|
||||
|
@ -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
|
||||
) );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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 );
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -1,18 +1,14 @@
|
||||
define( [
|
||||
"./core",
|
||||
"./var/getProto",
|
||||
"./var/indexOf",
|
||||
"./traversing/var/dir",
|
||||
"./traversing/var/siblings",
|
||||
"./traversing/var/rneedsContext",
|
||||
"./core/nodeName",
|
||||
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";
|
||||
|
||||
"./core/init",
|
||||
"./traversing/findFilter",
|
||||
"./selector"
|
||||
], function( jQuery, getProto, indexOf, dir, siblings, rneedsContext, nodeName ) {
|
||||
|
||||
"use strict";
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
} );
|
||||
|
@ -1,7 +1,3 @@
|
||||
define( [
|
||||
"./fnToString"
|
||||
], function( fnToString ) {
|
||||
"use strict";
|
||||
import fnToString from "./fnToString.js";
|
||||
|
||||
return fnToString.call( Object );
|
||||
} );
|
||||
export default fnToString.call( Object );
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return [];
|
||||
} );
|
||||
export default [];
|
||||
|
@ -1,6 +1,2 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
// [[Class]] -> type pairs
|
||||
return {};
|
||||
} );
|
||||
export default {};
|
||||
|
@ -1,5 +1 @@
|
||||
define( function() {
|
||||
"use strict";
|
||||
|
||||
return window.document;
|
||||
} );
|
||||
export default window.document;
|
||||
|
@ -1,7 +1,3 @@
|
||||
define( [
|
||||
"./document"
|
||||
], function( document ) {
|
||||
"use strict";
|
||||
import document from "./document.js";
|
||||
|
||||
return document.documentElement;
|
||||
} );
|
||||
export default document.documentElement;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user