diff options
Diffstat (limited to 'src')
112 files changed, 563 insertions, 1088 deletions
diff --git a/src/.eslintrc.json b/src/.eslintrc.json index 3d0ca185a..44cb3a179 100644 --- a/src/.eslintrc.json +++ b/src/.eslintrc.json @@ -3,11 +3,42 @@ "extends": "../.eslintrc-browser.json", + "parserOptions": { + "ecmaVersion": 2015, + "sourceType": "module" + }, + "overrides": [ { "files": "wrapper.js", + "parserOptions": { + "ecmaVersion": 5, + "sourceType": "script" + }, + "rules": { + "no-unused-vars": "off" + }, + "globals": { + "jQuery": false, + "module": true + } + }, + + { + "files": "exports/amd.js", "globals": { - "jQuery": false + "define": false + } + }, + + { + "files": "core.js", + "globals": { + + // Defining Symbol globally would create a danger of using + // it unguarded in another place, it seems safer to define + // it only for this module. + "Symbol": false } } ] diff --git a/src/ajax.js b/src/ajax.js index 53557253f..51bcf8a0e 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1,19 +1,15 @@ -define( [ - "./core", - "./var/document", - "./var/rnothtmlwhite", - "./ajax/var/location", - "./ajax/var/nonce", - "./ajax/var/rquery", - - "./core/init", - "./ajax/parseXML", - "./event/trigger", - "./deferred", - "./serialize" // jQuery.param -], function( jQuery, document, rnothtmlwhite, location, nonce, rquery ) { - -"use strict"; +import jQuery from "./core.js"; +import document from "./var/document.js"; +import rnothtmlwhite from "./var/rnothtmlwhite.js"; +import location from "./ajax/var/location.js"; +import nonce from "./ajax/var/nonce.js"; +import rquery from "./ajax/var/rquery.js"; + +import "./core/init.js"; +import "./ajax/parseXML.js"; +import "./event/trigger.js"; +import "./deferred.js"; +import "./serialize"; // jQuery.param var r20 = /%20/g, @@ -615,7 +611,8 @@ jQuery.extend( { // Add or update anti-cache param if needed if ( s.cache === false ) { cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + + ( nonce.guid++ ) + uncached; } // Put hash and anti-cache on the URL that will be requested (gh-1732) @@ -864,5 +861,4 @@ jQuery.each( [ "get", "post" ], function( _i, method ) { }; } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index dbdb4dbb8..1d612c1a9 100644 --- a/src/ajax/jsonp.js +++ b/src/ajax/jsonp.js @@ -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"; } } ); - -} ); diff --git a/src/ajax/load.js b/src/ajax/load.js index 574d6b4a7..9a91b990b 100644 --- a/src/ajax/load.js +++ b/src/ajax/load.js @@ -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; }; - -} ); diff --git a/src/ajax/parseXML.js b/src/ajax/parseXML.js index 0bdc49a7c..d547eab53 100644 --- a/src/ajax/parseXML.js +++ b/src/ajax/parseXML.js @@ -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; diff --git a/src/ajax/script.js b/src/ajax/script.js index 410c82cab..22dc29183 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -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 ) { }; } } ); - -} ); diff --git a/src/ajax/var/location.js b/src/ajax/var/location.js index 4171d18c3..78e6f07b3 100644 --- a/src/ajax/var/location.js +++ b/src/ajax/var/location.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return window.location; -} ); +export default window.location; diff --git a/src/ajax/var/nonce.js b/src/ajax/var/nonce.js index 33d0cffb6..b0070c699 100644 --- a/src/ajax/var/nonce.js +++ b/src/ajax/var/nonce.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return Date.now(); -} ); +export default { guid: Date.now() }; diff --git a/src/ajax/var/rquery.js b/src/ajax/var/rquery.js index 06fc37439..f18f87661 100644 --- a/src/ajax/var/rquery.js +++ b/src/ajax/var/rquery.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return ( /\?/ ); -} ); +export default ( /\?/ ); diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 3578ba167..f6bd52337 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -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 ) { } }; } ); - -} ); diff --git a/src/attributes.js b/src/attributes.js index 2d801e563..646107adc 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -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; diff --git a/src/attributes/attr.js b/src/attributes/attr.js index afa4f5775..cd34860e1 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -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 ) } }; } ); - -} ); diff --git a/src/attributes/classes.js b/src/attributes/classes.js index f1571eb5d..e020aa5cf 100644 --- a/src/attributes/classes.js +++ b/src/attributes/classes.js @@ -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; } } ); - -} ); diff --git a/src/attributes/prop.js b/src/attributes/prop.js index 651d9e215..d58adf369 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -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; } ); - -} ); diff --git a/src/attributes/val.js b/src/attributes/val.js index 02559ffaa..38e170ba8 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -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() { } }; } ); - -} ); diff --git a/src/callbacks.js b/src/callbacks.js index 140c4979e..19b3d7c1c 100644 --- a/src/callbacks.js +++ b/src/callbacks.js @@ -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; diff --git a/src/core.js b/src/core.js index af5d44214..7ea77c4f0 100644 --- a/src/core.js +++ b/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; diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js index df83cca52..b0238fd69 100644 --- a/src/core/DOMEval.js +++ b/src/core/DOMEval.js @@ -1,43 +1,39 @@ -define( [ - "../var/document" -], function( document ) { - "use strict"; +import document from "../var/document.js"; - var preservedScriptAttributes = { - type: true, - src: true, - nonce: true, - noModule: true - }; +var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true +}; - function DOMEval( code, node, doc ) { - doc = doc || document; +function DOMEval( code, node, doc ) { + doc = doc || document; - var i, val, - script = doc.createElement( "script" ); + var i, val, + script = doc.createElement( "script" ); - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { + script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { - // Support: Firefox <=64 - 66+, Edge <=18+ - // Some browsers don't support the "nonce" property on scripts. - // On the other hand, just using `getAttribute` is not enough as - // the `nonce` attribute is reset to an empty string whenever it - // becomes browsing-context connected. - // See https://github.com/whatwg/html/issues/2369 - // See https://html.spec.whatwg.org/#nonce-attributes - // The `node.getAttribute` check was added for the sake of - // `jQuery.globalEval` so that it can fake a nonce-containing node - // via an object. - val = node[ i ] || node.getAttribute && node.getAttribute( i ); - if ( val ) { - script.setAttribute( i, val ); - } + // Support: Firefox <=64 - 66+, Edge <=18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); } } - doc.head.appendChild( script ).parentNode.removeChild( script ); } + doc.head.appendChild( script ).parentNode.removeChild( script ); +} - return DOMEval; -} ); +export default DOMEval; diff --git a/src/core/access.js b/src/core/access.js index e088a6557..4eaec4695 100644 --- a/src/core/access.js +++ b/src/core/access.js @@ -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; diff --git a/src/core/camelCase.js b/src/core/camelCase.js index 61ed90d05..f12a2c67d 100644 --- a/src/core/camelCase.js +++ b/src/core/camelCase.js @@ -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; diff --git a/src/core/init.js b/src/core/init.js index 71f30e926..c2f35e1f4 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -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; diff --git a/src/core/isAttached.js b/src/core/isAttached.js index 579bcffb2..3857d94a8 100644 --- a/src/core/isAttached.js +++ b/src/core/isAttached.js @@ -1,23 +1,20 @@ -define( [ - "../core", - "../var/documentElement", - "../selector/contains" // jQuery.contains -], function( jQuery, documentElement ) { - "use strict"; +import jQuery from "../core.js"; +import documentElement from "../var/documentElement.js"; - var isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ); - }, - composed = { composed: true }; +import "../selector/contains.js"; // jQuery.contains - // Support: IE 9 - 11+, Edge 12 - 18+ - // Check attachment across shadow DOM boundaries when possible (gh-3504) - if ( documentElement.getRootNode ) { - isAttached = function( elem ) { - return jQuery.contains( elem.ownerDocument, elem ) || - elem.getRootNode( composed ) === elem.ownerDocument; - }; - } +var isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ); + }, + composed = { composed: true }; - return isAttached; -} ); +// Support: IE 9 - 11+, Edge 12 - 18+ +// Check attachment across shadow DOM boundaries when possible (gh-3504) +if ( documentElement.getRootNode ) { + isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; + }; +} + +export default isAttached; diff --git a/src/core/nodeName.js b/src/core/nodeName.js index 8a5f5f036..d10e484bc 100644 --- a/src/core/nodeName.js +++ b/src/core/nodeName.js @@ -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; diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js index 8c5268fb1..15278fa02 100644 --- a/src/core/parseHTML.js +++ b/src/core/parseHTML.js @@ -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; - -} ); diff --git a/src/core/ready-no-deferred.js b/src/core/ready-no-deferred.js index 2c3fc1b84..51f6d7f6b 100644 --- a/src/core/ready-no-deferred.js +++ b/src/core/ready-no-deferred.js @@ -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 ); } - -} ); diff --git a/src/core/ready.js b/src/core/ready.js index 3abb6c03a..d6c507e41 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -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 ); } - -} ); diff --git a/src/core/readyException.js b/src/core/readyException.js index 72bdd90b5..1b5512c15 100644 --- a/src/core/readyException.js +++ b/src/core/readyException.js @@ -1,13 +1,7 @@ -define( [ - "../core" -], function( jQuery ) { - -"use strict"; +import jQuery from "../core.js"; jQuery.readyException = function( error ) { window.setTimeout( function() { throw error; } ); }; - -} ); diff --git a/src/core/stripAndCollapse.js b/src/core/stripAndCollapse.js index 2b63820da..944a79362 100644 --- a/src/core/stripAndCollapse.js +++ b/src/core/stripAndCollapse.js @@ -1,14 +1,10 @@ -define( [ - "../var/rnothtmlwhite" -], function( rnothtmlwhite ) { - "use strict"; +import rnothtmlwhite from "../var/rnothtmlwhite.js"; - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } +// Strip and collapse whitespace according to HTML spec +// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace +function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); +} - return stripAndCollapse; -} ); +export default stripAndCollapse; diff --git a/src/core/toType.js b/src/core/toType.js index c555ef9df..67af8a67f 100644 --- a/src/core/toType.js +++ b/src/core/toType.js @@ -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; diff --git a/src/core/var/rhtml.js b/src/core/var/rhtml.js index d7921aa3b..3dace14c5 100644 --- a/src/core/var/rhtml.js +++ b/src/core/var/rhtml.js @@ -1,7 +1 @@ -define( function() { - -"use strict"; - -return ( /HTML$/i ); - -} ); +export default ( /HTML$/i ); diff --git a/src/core/var/rsingleTag.js b/src/core/var/rsingleTag.js index 340b80db0..5bf52d568 100644 --- a/src/core/var/rsingleTag.js +++ b/src/core/var/rsingleTag.js @@ -1,7 +1,3 @@ -define( function() { - "use strict"; - - // rsingleTag matches a string consisting of a single HTML element with no attributes - // and captures the element's name - return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); -} ); +// rsingleTag matches a string consisting of a single HTML element with no attributes +// and captures the element's name +export default ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); diff --git a/src/css.js b/src/css.js index c700c0aa5..6d67ffaa7 100644 --- a/src/css.js +++ b/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", - - "./core/init", - "./core/ready", - "./selector" // contains -], function( jQuery, access, nodeName, rcssNum, isIE, rnumnonpx, cssExpand, isAutoPx, - cssCamelCase, getStyles, swap, curCSS, adjustCSS, support, finalPropName ) { - -"use strict"; +import jQuery from "./core.js"; +import access from "./core/access.js"; +import nodeName from "./core/nodeName.js"; +import rcssNum from "./var/rcssNum.js"; +import isIE from "./var/isIE.js"; +import rnumnonpx from "./css/var/rnumnonpx.js"; +import cssExpand from "./css/var/cssExpand.js"; +import isAutoPx from "./css/isAutoPx.js"; +import cssCamelCase from "./css/cssCamelCase.js"; +import getStyles from "./css/var/getStyles.js"; +import swap from "./css/var/swap.js"; +import curCSS from "./css/curCSS.js"; +import adjustCSS from "./css/adjustCSS.js"; +import support from "./css/support.js"; +import finalPropName from "./css/finalPropName.js"; + +import "./core/init.js"; +import "./core/ready.js"; +import "./selector.js"; // contains var @@ -426,5 +421,4 @@ jQuery.fn.extend( { } } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/css/adjustCSS.js b/src/css/adjustCSS.js index 5341a7890..d973ff386 100644 --- a/src/css/adjustCSS.js +++ b/src/css/adjustCSS.js @@ -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; diff --git a/src/css/cssCamelCase.js b/src/css/cssCamelCase.js index 9b5c328ad..895303248 100644 --- a/src/css/cssCamelCase.js +++ b/src/css/cssCamelCase.js @@ -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; diff --git a/src/css/curCSS.js b/src/css/curCSS.js index 882e7423e..59a639f68 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -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; diff --git a/src/css/finalPropName.js b/src/css/finalPropName.js index c290eb2b4..40d2fb193 100644 --- a/src/css/finalPropName.js +++ b/src/css/finalPropName.js @@ -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; diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index d7a9339dd..1f892dfe0 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -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 ); }; - -} ); diff --git a/src/css/isAutoPx.js b/src/css/isAutoPx.js index ff4b7def1..a55d5bbcc 100644 --- a/src/css/isAutoPx.js +++ b/src/css/isAutoPx.js @@ -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; diff --git a/src/css/showHide.js b/src/css/showHide.js index 3eeafef11..dc273f98c 100644 --- a/src/css/showHide.js +++ b/src/css/showHide.js @@ -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; diff --git a/src/css/support.js b/src/css/support.js index 053f494b2..505adafb6 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -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; diff --git a/src/css/var/cssExpand.js b/src/css/var/cssExpand.js index dd2007c3f..66062e2ee 100644 --- a/src/css/var/cssExpand.js +++ b/src/css/var/cssExpand.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return [ "Top", "Right", "Bottom", "Left" ]; -} ); +export default [ "Top", "Right", "Bottom", "Left" ]; diff --git a/src/css/var/getStyles.js b/src/css/var/getStyles.js index 7adbdcfb5..e55da23ef 100644 --- a/src/css/var/getStyles.js +++ b/src/css/var/getStyles.js @@ -1,19 +1,15 @@ -define( function() { - "use strict"; +export default function( elem ) { - return function( elem ) { + // Support: IE <=11+ (trac-14150) + // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )` + // break. Using `elem.ownerDocument.defaultView` avoids the issue. + var view = elem.ownerDocument.defaultView; - // Support: IE <=11+ (trac-14150) - // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )` - // break. Using `elem.ownerDocument.defaultView` avoids the issue. - var view = elem.ownerDocument.defaultView; + // `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView` + // property; check `defaultView` truthiness to fallback to window in such a case. + if ( !view ) { + view = window; + } - // `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView` - // property; check `defaultView` truthiness to fallback to window in such a case. - if ( !view ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; -} ); + return view.getComputedStyle( elem ); +}; diff --git a/src/css/var/isHiddenWithinTree.js b/src/css/var/isHiddenWithinTree.js index 1e99b96d3..0cc163178 100644 --- a/src/css/var/isHiddenWithinTree.js +++ b/src/css/var/isHiddenWithinTree.js @@ -1,26 +1,20 @@ -define( [ - "../../core" +import jQuery from "../../core.js"; - // css is assumed -], function( jQuery ) { - "use strict"; +// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or +// through the CSS cascade), which is useful in deciding whether or not to make it visible. +// It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways: +// * A hidden ancestor does not force an element to be classified as hidden. +// * Being disconnected from the document does not force an element to be classified as hidden. +// These differences improve the behavior of .toggle() et al. when applied to elements that are +// detached or contained within hidden ancestors (gh-2404, gh-2863). +export default function( elem, el ) { - // isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or - // through the CSS cascade), which is useful in deciding whether or not to make it visible. - // It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways: - // * A hidden ancestor does not force an element to be classified as hidden. - // * Being disconnected from the document does not force an element to be classified as hidden. - // These differences improve the behavior of .toggle() et al. when applied to elements that are - // detached or contained within hidden ancestors (gh-2404, gh-2863). - return function( elem, el ) { + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - jQuery.css( elem, "display" ) === "none"; - }; -} ); + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + jQuery.css( elem, "display" ) === "none"; +}; diff --git a/src/css/var/rnumnonpx.js b/src/css/var/rnumnonpx.js index 056cda7ad..18a9dad6c 100644 --- a/src/css/var/rnumnonpx.js +++ b/src/css/var/rnumnonpx.js @@ -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" ); diff --git a/src/css/var/swap.js b/src/css/var/swap.js index 69388e5f7..e720fff9b 100644 --- a/src/css/var/swap.js +++ b/src/css/var/swap.js @@ -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; }; - -} ); diff --git a/src/data.js b/src/data.js index d6706493a..cd658b386 100644 --- a/src/data.js +++ b/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; diff --git a/src/data/Data.js b/src/data/Data.js index c94480fcd..556f4e39c 100644 --- a/src/data/Data.js +++ b/src/data/Data.js @@ -1,11 +1,7 @@ -define( [ - "../core", - "../core/camelCase", - "../var/rnothtmlwhite", - "./var/acceptData" -], function( jQuery, camelCase, rnothtmlwhite, acceptData ) { - -"use strict"; +import jQuery from "../core.js"; +import camelCase from "../core/camelCase.js"; +import rnothtmlwhite from "../var/rnothtmlwhite.js"; +import acceptData from "./var/acceptData.js"; function Data() { this.expando = jQuery.expando + Data.uid++; @@ -158,5 +154,4 @@ Data.prototype = { } }; -return Data; -} ); +export default Data; diff --git a/src/data/var/acceptData.js b/src/data/var/acceptData.js index e00f7538b..4fc47b30a 100644 --- a/src/data/var/acceptData.js +++ b/src/data/var/acceptData.js @@ -1,11 +1,7 @@ -define( function() { - -"use strict"; - /** * Determines whether an object can have data */ -return function( owner ) { +export default function( owner ) { // Accepts only: // - Node @@ -15,5 +11,3 @@ return function( owner ) { // - Any return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; - -} ); diff --git a/src/data/var/dataPriv.js b/src/data/var/dataPriv.js index 72713c88c..94ea1190e 100644 --- a/src/data/var/dataPriv.js +++ b/src/data/var/dataPriv.js @@ -1,7 +1,3 @@ -define( [ - "../Data" -], function( Data ) { - "use strict"; +import Data from "../Data.js"; - return new Data(); -} ); +export default new Data(); diff --git a/src/data/var/dataUser.js b/src/data/var/dataUser.js index 72713c88c..94ea1190e 100644 --- a/src/data/var/dataUser.js +++ b/src/data/var/dataUser.js @@ -1,7 +1,3 @@ -define( [ - "../Data" -], function( Data ) { - "use strict"; +import Data from "../Data.js"; - return new Data(); -} ); +export default new Data(); diff --git a/src/deferred.js b/src/deferred.js index 771e8381b..d4eaf7a4b 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -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; diff --git a/src/deferred/exceptionHook.js b/src/deferred/exceptionHook.js index f6faf4123..2e3c7cc35 100644 --- a/src/deferred/exceptionHook.js +++ b/src/deferred/exceptionHook.js @@ -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 ) { ); } }; - -} ); diff --git a/src/deprecated.js b/src/deprecated.js index 11728081c..b7879c208 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -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 ); }; -} ); diff --git a/src/dimensions.js b/src/dimensions.js index 2a2c0391d..6f1bf7d2f 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -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; diff --git a/src/effects.js b/src/effects.js index 46ad988ad..030d3c7ba 100644 --- a/src/effects.js +++ b/src/effects.js @@ -1,26 +1,21 @@ -define( [ - "./core", - "./var/document", - "./var/rcssNum", - "./var/rnothtmlwhite", - "./css/var/cssExpand", - "./css/var/isHiddenWithinTree", - "./css/adjustCSS", - "./css/cssCamelCase", - "./data/var/dataPriv", - "./css/showHide", - - "./core/init", - "./queue", - "./deferred", - "./traversing", - "./manipulation", - "./css", - "./effects/Tween" -], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand, - isHiddenWithinTree, adjustCSS, cssCamelCase, dataPriv, showHide ) { - -"use strict"; +import jQuery from "./core.js"; +import document from "./var/document.js"; +import rcssNum from "./var/rcssNum.js"; +import rnothtmlwhite from "./var/rnothtmlwhite.js"; +import cssExpand from "./css/var/cssExpand.js"; +import isHiddenWithinTree from "./css/var/isHiddenWithinTree.js"; +import adjustCSS from "./css/adjustCSS.js"; +import cssCamelCase from "./css/cssCamelCase.js"; +import dataPriv from "./data/var/dataPriv.js"; +import showHide from "./css/showHide.js"; + +import "./core/init.js"; +import "./queue.js"; +import "./deferred.js"; +import "./traversing.js"; +import "./manipulation.js"; +import "./css.js"; +import "./effects/Tween.js"; var fxNow, inProgress, @@ -225,12 +220,9 @@ function defaultPrefilter( elem, props, opts ) { showHide( [ elem ], true ); } - /* eslint-disable no-loop-func */ - + // eslint-disable-next-line no-loop-func anim.done( function() { - /* eslint-enable no-loop-func */ - // The final step of a "hide" animation is actually hiding the element if ( !hidden ) { showHide( [ elem ] ); @@ -693,5 +685,4 @@ jQuery.fx.speeds = { _default: 400 }; -return jQuery; -} ); +export default jQuery; diff --git a/src/effects/Tween.js b/src/effects/Tween.js index 0c5fe67d3..9a75a9af2 100644 --- a/src/effects/Tween.js +++ b/src/effects/Tween.js @@ -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 = {}; - -} ); diff --git a/src/effects/animatedSelector.js b/src/effects/animatedSelector.js index 24c1bfba2..327956f72 100644 --- a/src/effects/animatedSelector.js +++ b/src/effects/animatedSelector.js @@ -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; }; - -} ); diff --git a/src/event.js b/src/event.js index 405d176a0..7f66d49de 100644 --- a/src/event.js +++ b/src/event.js @@ -1,19 +1,14 @@ -define( [ - "./core", - "./var/document", - "./var/documentElement", - "./var/rnothtmlwhite", - "./var/rcheckableType", - "./var/slice", - "./data/var/dataPriv", - "./core/nodeName", - - "./core/init", - "./selector" -], function( jQuery, document, documentElement, rnothtmlwhite, - rcheckableType, slice, dataPriv, nodeName ) { - -"use strict"; +import jQuery from "./core.js"; +import document from "./var/document.js"; +import documentElement from "./var/documentElement.js"; +import rnothtmlwhite from "./var/rnothtmlwhite.js"; +import rcheckableType from "./var/rcheckableType.js"; +import slice from "./var/slice.js"; +import dataPriv from "./data/var/dataPriv.js"; +import nodeName from "./core/nodeName.js"; + +import "./core/init.js"; +import "./selector.js"; var rkeyEvent = /^key/, @@ -857,5 +852,4 @@ jQuery.fn.extend( { } } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/event/ajax.js b/src/event/ajax.js index dd9c0ffe2..8c64d9b3e 100644 --- a/src/event/ajax.js +++ b/src/event/ajax.js @@ -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 ); }; } ); - -} ); diff --git a/src/event/alias.js b/src/event/alias.js index 46bd1ae80..346951b11 100644 --- a/src/event/alias.js +++ b/src/event/alias.js @@ -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 ); } } ); - -} ); diff --git a/src/event/trigger.js b/src/event/trigger.js index 39f641b70..aba4c7edd 100644 --- a/src/event/trigger.js +++ b/src/event/trigger.js @@ -1,14 +1,11 @@ -define( [ - "../core", - "../var/document", - "../data/var/dataPriv", - "../data/var/acceptData", - "../var/hasOwn", - "../var/isWindow", - "../event" -], function( jQuery, document, dataPriv, acceptData, hasOwn, isWindow ) { - -"use strict"; +import jQuery from "../core.js"; +import document from "../var/document.js"; +import dataPriv from "../data/var/dataPriv.js"; +import acceptData from "../data/var/acceptData.js"; +import hasOwn from "../var/hasOwn.js"; +import isWindow from "../var/isWindow.js"; + +import "../event.js"; var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function( e ) { @@ -194,5 +191,4 @@ jQuery.fn.extend( { } } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/exports/amd.js b/src/exports/amd.js index cbb1ef580..44587ab3a 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -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; } ); } - -} ); diff --git a/src/exports/global.js b/src/exports/global.js index 460b56e47..b49496fbb 100644 --- a/src/exports/global.js +++ b/src/exports/global.js @@ -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; } - -} ); diff --git a/src/jquery.js b/src/jquery.js index aee1a6387..24e58a93c 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -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; diff --git a/src/manipulation.js b/src/manipulation.js index 803a67bd6..7140748ed 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -1,32 +1,25 @@ -define( [ - "./core", - "./core/isAttached", - "./var/flat", - "./var/isIE", - "./var/push", - "./core/access", - "./manipulation/var/rtagName", - "./manipulation/var/rscriptType", - "./manipulation/wrapMap", - "./manipulation/getAll", - "./manipulation/setGlobalEval", - "./manipulation/buildFragment", - - "./data/var/dataPriv", - "./data/var/dataUser", - "./data/var/acceptData", - "./core/DOMEval", - "./core/nodeName", - - "./core/init", - "./traversing", - "./selector", - "./event" -], function( jQuery, isAttached, flat, isIE, push, access, rtagName, - rscriptType, wrapMap, getAll, setGlobalEval, buildFragment, - dataPriv, dataUser, acceptData, DOMEval, nodeName ) { - -"use strict"; +import jQuery from "./core.js"; +import isAttached from "./core/isAttached.js"; +import flat from "./var/flat.js"; +import isIE from "./var/isIE.js"; +import push from "./var/push.js"; +import access from "./core/access.js"; +import rtagName from "./manipulation/var/rtagName.js"; +import rscriptType from "./manipulation/var/rscriptType.js"; +import wrapMap from "./manipulation/wrapMap.js"; +import getAll from "./manipulation/getAll.js"; +import setGlobalEval from "./manipulation/setGlobalEval.js"; +import buildFragment from "./manipulation/buildFragment.js"; +import dataPriv from "./data/var/dataPriv.js"; +import dataUser from "./data/var/dataUser.js"; +import acceptData from "./data/var/acceptData.js"; +import DOMEval from "./core/DOMEval.js"; +import nodeName from "./core/nodeName.js"; + +import "./core/init.js"; +import "./traversing.js"; +import "./selector.js"; +import "./event.js"; var @@ -458,5 +451,4 @@ jQuery.each( { }; } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/manipulation/_evalUrl.js b/src/manipulation/_evalUrl.js index 9a4d2ac6f..54133fc9b 100644 --- a/src/manipulation/_evalUrl.js +++ b/src/manipulation/_evalUrl.js @@ -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; diff --git a/src/manipulation/buildFragment.js b/src/manipulation/buildFragment.js index 01dcff6e5..daf383aea 100644 --- a/src/manipulation/buildFragment.js +++ b/src/manipulation/buildFragment.js @@ -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; diff --git a/src/manipulation/getAll.js b/src/manipulation/getAll.js index 89634d694..995d22c0c 100644 --- a/src/manipulation/getAll.js +++ b/src/manipulation/getAll.js @@ -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; diff --git a/src/manipulation/setGlobalEval.js b/src/manipulation/setGlobalEval.js index cf95240a4..c6f7ee9ab 100644 --- a/src/manipulation/setGlobalEval.js +++ b/src/manipulation/setGlobalEval.js @@ -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; diff --git a/src/manipulation/var/rscriptType.js b/src/manipulation/var/rscriptType.js index cd1430a7e..879651c7c 100644 --- a/src/manipulation/var/rscriptType.js +++ b/src/manipulation/var/rscriptType.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return ( /^$|^module$|\/(?:java|ecma)script/i ); -} ); +export default ( /^$|^module$|\/(?:java|ecma)script/i ); diff --git a/src/manipulation/var/rtagName.js b/src/manipulation/var/rtagName.js index 7435620c1..b35acc999 100644 --- a/src/manipulation/var/rtagName.js +++ b/src/manipulation/var/rtagName.js @@ -1,8 +1,4 @@ -define( function() { - "use strict"; - - // rtagName captures the name from the first start tag in a string of HTML - // https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state - // https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state - return ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); -} ); +// rtagName captures the name from the first start tag in a string of HTML +// https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state +// https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state +export default ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js index 065225928..01937ecc3 100644 --- a/src/manipulation/wrapMap.js +++ b/src/manipulation/wrapMap.js @@ -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; diff --git a/src/offset.js b/src/offset.js index 91c96d877..7d98083b9 100644 --- a/src/offset.js +++ b/src/offset.js @@ -1,14 +1,11 @@ -define( [ - "./core", - "./core/access", - "./var/documentElement", - "./var/isWindow", - "./core/init", - "./css", - "./selector" // contains -], function( jQuery, access, documentElement, isWindow ) { - -"use strict"; +import jQuery from "./core.js"; +import access from "./core/access.js"; +import documentElement from "./var/documentElement.js"; +import isWindow from "./var/isWindow.js"; + +import "./core/init.js"; +import "./css.js"; +import "./selector.js"; // contains jQuery.offset = { setOffset: function( elem, options, i ) { @@ -201,5 +198,4 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( }; } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/queue.js b/src/queue.js index fbbbeab71..0028d7e7f 100644 --- a/src/queue.js +++ b/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; diff --git a/src/queue/delay.js b/src/queue/delay.js index d471eedc5..fe3a6f6b7 100644 --- a/src/queue/delay.js +++ b/src/queue/delay.js @@ -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; -} ); diff --git a/src/selector.js b/src/selector.js index 8033f1115..019f25d62 100644 --- a/src/selector.js +++ b/src/selector.js @@ -1,22 +1,17 @@ -define( [ - "./core", - "./core/nodeName", - "./var/document", - "./var/documentElement", - "./var/indexOf", - "./var/pop", - "./var/push", - "./selector/rbuggyQSA", - "./selector/support", - - // The following utils are attached directly to the jQuery object. - "./selector/contains", - "./selector/escapeSelector", - "./selector/uniqueSort" -], function( jQuery, nodeName, document, documentElement, indexOf, pop, push, - rbuggyQSA, support ) { - -"use strict"; +import jQuery from "./core.js"; +import nodeName from "./core/nodeName.js"; +import document from "./var/document.js"; +import documentElement from "./var/documentElement.js"; +import indexOf from "./var/indexOf.js"; +import pop from "./var/pop.js"; +import push from "./var/push.js"; +import rbuggyQSA from "./selector/rbuggyQSA.js"; +import support from "./selector/support.js"; + +// The following utils are attached directly to the jQuery object. +import "./selector/contains.js"; +import "./selector/escapeSelector.js"; +import "./selector/uniqueSort.js"; var preferredDoc = document, matches = documentElement.matches || documentElement.msMatchesSelector; @@ -1642,5 +1637,3 @@ setDocument(); jQuery.find = find; } )(); - -} ); diff --git a/src/selector/contains.js b/src/selector/contains.js index 0d6273c28..a62b97ab5 100644 --- a/src/selector/contains.js +++ b/src/selector/contains.js @@ -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 ) ); }; - -} ); diff --git a/src/selector/escapeSelector.js b/src/selector/escapeSelector.js index 1d89c2f00..bc61355fa 100644 --- a/src/selector/escapeSelector.js +++ b/src/selector/escapeSelector.js @@ -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 ); }; - -} ); diff --git a/src/selector/rbuggyQSA.js b/src/selector/rbuggyQSA.js index eee151afb..f638fc429 100644 --- a/src/selector/rbuggyQSA.js +++ b/src/selector/rbuggyQSA.js @@ -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; diff --git a/src/selector/support.js b/src/selector/support.js index 86cd2d9ae..cc584bf66 100644 --- a/src/selector/support.js +++ b/src/selector/support.js @@ -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; diff --git a/src/selector/uniqueSort.js b/src/selector/uniqueSort.js index ec97de849..d0bf69198 100644 --- a/src/selector/uniqueSort.js +++ b/src/selector/uniqueSort.js @@ -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; }; - -} ); diff --git a/src/serialize.js b/src/serialize.js index 6743b78e9..a25097edc 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -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; diff --git a/src/traversing.js b/src/traversing.js index f71fbe69e..5ce33f317 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -1,18 +1,14 @@ -define( [ - "./core", - "./var/getProto", - "./var/indexOf", - "./traversing/var/dir", - "./traversing/var/siblings", - "./traversing/var/rneedsContext", - "./core/nodeName", - - "./core/init", - "./traversing/findFilter", - "./selector" -], function( jQuery, getProto, indexOf, dir, siblings, rneedsContext, nodeName ) { - -"use strict"; +import jQuery from "./core.js"; +import getProto from "./var/getProto.js"; +import indexOf from "./var/indexOf.js"; +import dir from "./traversing/var/dir.js"; +import siblings from "./traversing/var/siblings.js"; +import rneedsContext from "./traversing/var/rneedsContext.js"; +import nodeName from "./core/nodeName.js"; + +import "./core/init.js"; +import "./traversing/findFilter.js"; +import "./selector.js"; var rparentsprev = /^(?:parents|prev(?:Until|All))/, @@ -194,5 +190,4 @@ jQuery.each( { }; } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/traversing/findFilter.js b/src/traversing/findFilter.js index 2f526b713..42022180c 100644 --- a/src/traversing/findFilter.js +++ b/src/traversing/findFilter.js @@ -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; } } ); - -} ); diff --git a/src/traversing/var/dir.js b/src/traversing/var/dir.js index 366a823d6..b34bfa4d4 100644 --- a/src/traversing/var/dir.js +++ b/src/traversing/var/dir.js @@ -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; }; - -} ); diff --git a/src/traversing/var/rneedsContext.js b/src/traversing/var/rneedsContext.js index d0663cee8..9038e17cd 100644 --- a/src/traversing/var/rneedsContext.js +++ b/src/traversing/var/rneedsContext.js @@ -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; diff --git a/src/traversing/var/siblings.js b/src/traversing/var/siblings.js index 952629d0c..910b35a7c 100644 --- a/src/traversing/var/siblings.js +++ b/src/traversing/var/siblings.js @@ -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; }; - -} ); diff --git a/src/var/ObjectFunctionString.js b/src/var/ObjectFunctionString.js index f9e850fd8..c8fdcd989 100644 --- a/src/var/ObjectFunctionString.js +++ b/src/var/ObjectFunctionString.js @@ -1,7 +1,3 @@ -define( [ - "./fnToString" -], function( fnToString ) { - "use strict"; +import fnToString from "./fnToString.js"; - return fnToString.call( Object ); -} ); +export default fnToString.call( Object ); diff --git a/src/var/arr.js b/src/var/arr.js index 84713d838..d6d1738de 100644 --- a/src/var/arr.js +++ b/src/var/arr.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return []; -} ); +export default []; diff --git a/src/var/class2type.js b/src/var/class2type.js index 4365d46a2..758dff6de 100644 --- a/src/var/class2type.js +++ b/src/var/class2type.js @@ -1,6 +1,2 @@ -define( function() { - "use strict"; - - // [[Class]] -> type pairs - return {}; -} ); +// [[Class]] -> type pairs +export default {}; diff --git a/src/var/document.js b/src/var/document.js index dd3939df4..db89b6875 100644 --- a/src/var/document.js +++ b/src/var/document.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return window.document; -} ); +export default window.document; diff --git a/src/var/documentElement.js b/src/var/documentElement.js index 0e3f8b48c..4bad20e54 100644 --- a/src/var/documentElement.js +++ b/src/var/documentElement.js @@ -1,7 +1,3 @@ -define( [ - "./document" -], function( document ) { - "use strict"; +import document from "./document.js"; - return document.documentElement; -} ); +export default document.documentElement; diff --git a/src/var/flat.js b/src/var/flat.js index 6c7a27169..172420552 100644 --- a/src/var/flat.js +++ b/src/var/flat.js @@ -1,15 +1,9 @@ -define( [ - "./arr" -], function( arr ) { - -"use strict"; +import arr from "./arr.js"; // Support: IE 11+, Edge 18+ // Provide fallback for browsers without Array#flat. -return arr.flat ? function( array ) { +export default arr.flat ? function( array ) { return arr.flat.call( array ); } : function( array ) { return arr.concat.apply( [], array ); }; - -} ); diff --git a/src/var/fnToString.js b/src/var/fnToString.js index 18c43ff30..10042138e 100644 --- a/src/var/fnToString.js +++ b/src/var/fnToString.js @@ -1,7 +1,3 @@ -define( [ - "./hasOwn" -], function( hasOwn ) { - "use strict"; +import hasOwn from "./hasOwn.js"; - return hasOwn.toString; -} ); +export default hasOwn.toString; diff --git a/src/var/getProto.js b/src/var/getProto.js index 965fab8fb..392cd3973 100644 --- a/src/var/getProto.js +++ b/src/var/getProto.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return Object.getPrototypeOf; -} ); +export default Object.getPrototypeOf; diff --git a/src/var/hasOwn.js b/src/var/hasOwn.js index 44ab6807d..62f2c1852 100644 --- a/src/var/hasOwn.js +++ b/src/var/hasOwn.js @@ -1,7 +1,3 @@ -define( [ - "./class2type" -], function( class2type ) { - "use strict"; +import class2type from "./class2type.js"; - return class2type.hasOwnProperty; -} ); +export default class2type.hasOwnProperty; diff --git a/src/var/indexOf.js b/src/var/indexOf.js index 8320b98e5..f1342c8f7 100644 --- a/src/var/indexOf.js +++ b/src/var/indexOf.js @@ -1,7 +1,3 @@ -define( [ - "./arr" -], function( arr ) { - "use strict"; +import arr from "./arr.js"; - return arr.indexOf; -} ); +export default arr.indexOf; diff --git a/src/var/isIE.js b/src/var/isIE.js index e6a37cb5a..a239745ea 100644 --- a/src/var/isIE.js +++ b/src/var/isIE.js @@ -1,7 +1,3 @@ -define( [ - "./document" -], function( document ) { - "use strict"; +import document from "./document.js"; - return document.documentMode; -} ); +export default document.documentMode; diff --git a/src/var/isWindow.js b/src/var/isWindow.js index 2ba1168dd..fa64581ee 100644 --- a/src/var/isWindow.js +++ b/src/var/isWindow.js @@ -1,8 +1,3 @@ -define( function() { - "use strict"; - - return function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - -} ); +export default function isWindow( obj ) { + return obj != null && obj === obj.window; +}; diff --git a/src/var/pnum.js b/src/var/pnum.js index 6f06d73b1..5f6bca473 100644 --- a/src/var/pnum.js +++ b/src/var/pnum.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; -} ); +export default ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; diff --git a/src/var/pop.js b/src/var/pop.js index 6f1eb903c..b1c9131c5 100644 --- a/src/var/pop.js +++ b/src/var/pop.js @@ -1,7 +1,3 @@ -define( [ - "./arr" -], function( arr ) { - "use strict"; +import arr from "./arr.js"; - return arr.pop; -} ); +export default arr.pop; diff --git a/src/var/push.js b/src/var/push.js index 94656209a..2758aa587 100644 --- a/src/var/push.js +++ b/src/var/push.js @@ -1,7 +1,3 @@ -define( [ - "./arr" -], function( arr ) { - "use strict"; +import arr from "./arr.js"; - return arr.push; -} ); +export default arr.push; diff --git a/src/var/rcheckableType.js b/src/var/rcheckableType.js index 25bbcb418..9fc4b55dc 100644 --- a/src/var/rcheckableType.js +++ b/src/var/rcheckableType.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return ( /^(?:checkbox|radio)$/i ); -} ); +export default ( /^(?:checkbox|radio)$/i ); diff --git a/src/var/rcssNum.js b/src/var/rcssNum.js index 4214b14aa..c96eb65ca 100644 --- a/src/var/rcssNum.js +++ b/src/var/rcssNum.js @@ -1,9 +1,3 @@ -define( [ - "../var/pnum" -], function( pnum ) { +import pnum from "../var/pnum.js"; -"use strict"; - -return new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - -} ); +export default new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); diff --git a/src/var/rnothtmlwhite.js b/src/var/rnothtmlwhite.js index 29eebf287..db2a9e360 100644 --- a/src/var/rnothtmlwhite.js +++ b/src/var/rnothtmlwhite.js @@ -1,8 +1,4 @@ -define( function() { - "use strict"; - - // Only count HTML whitespace - // Other whitespace should count in values - // https://infra.spec.whatwg.org/#ascii-whitespace - return ( /[^\x20\t\r\n\f]+/g ); -} ); +// Only count HTML whitespace +// Other whitespace should count in values +// https://infra.spec.whatwg.org/#ascii-whitespace +export default ( /[^\x20\t\r\n\f]+/g ); diff --git a/src/var/slice.js b/src/var/slice.js index 915f837be..4d767ac98 100644 --- a/src/var/slice.js +++ b/src/var/slice.js @@ -1,7 +1,3 @@ -define( [ - "./arr" -], function( arr ) { - "use strict"; +import arr from "./arr.js"; - return arr.slice; -} ); +export default arr.slice; diff --git a/src/var/sort.js b/src/var/sort.js index a943fa77c..031be7706 100644 --- a/src/var/sort.js +++ b/src/var/sort.js @@ -1,7 +1,3 @@ -define( [ - "./arr" -], function( arr ) { - "use strict"; +import arr from "./arr.js"; - return arr.sort; -} ); +export default arr.sort; diff --git a/src/var/support.js b/src/var/support.js index 094d0aece..cc0a15d15 100644 --- a/src/var/support.js +++ b/src/var/support.js @@ -1,6 +1,2 @@ -define( function() { - "use strict"; - - // All support tests are defined in their respective modules. - return {}; -} ); +// All support tests are defined in their respective modules. +export default {}; diff --git a/src/var/toString.js b/src/var/toString.js index ff4ecdc72..01682d601 100644 --- a/src/var/toString.js +++ b/src/var/toString.js @@ -1,7 +1,3 @@ -define( [ - "./class2type" -], function( class2type ) { - "use strict"; +import class2type from "./class2type.js"; - return class2type.toString; -} ); +export default class2type.toString; diff --git a/src/var/trim.js b/src/var/trim.js index a5e75af36..77d925fb0 100644 --- a/src/var/trim.js +++ b/src/var/trim.js @@ -1,5 +1 @@ -define( function() { - "use strict"; - - return "".trim; -} ); +export default "".trim; diff --git a/src/wrap.js b/src/wrap.js index a42c04da7..cd7636b8d 100644 --- a/src/wrap.js +++ b/src/wrap.js @@ -1,11 +1,8 @@ -define( [ - "./core", - "./core/init", - "./manipulation", // clone - "./traversing" // parent, contents -], function( jQuery ) { +import jQuery from "./core.js"; -"use strict"; +import "./core/init.js"; +import "./manipulation.js"; // clone +import "./traversing.js"; // parent, contents jQuery.fn.extend( { wrapAll: function( html ) { @@ -73,5 +70,4 @@ jQuery.fn.extend( { } } ); -return jQuery; -} ); +export default jQuery; diff --git a/src/wrapper.js b/src/wrapper.js index dfbd9a028..22ddbf812 100644 --- a/src/wrapper.js +++ b/src/wrapper.js @@ -1,4 +1,3 @@ -/* eslint-disable no-unused-vars*/ /*! * jQuery JavaScript Library v@VERSION * https://jquery.com/ |