From f75daab09102a4dd5107deadb55d4a169f86254a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Tue, 12 Sep 2023 02:27:19 +0200 Subject: [PATCH] Core: Use named exports in `src/` The `default` export is treated differently across tooling when transpiled to CommonJS - tools differ on whether `module.exports` represents the full module object or just its default export. Switch `src/` modules to named exports for tooling consistency. Fixes gh-5262 Closes gh-5292 --- build/tasks/build.js | 2 +- src/ajax.js | 14 ++++---- src/ajax/binary.js | 2 +- src/ajax/jsonp.js | 6 ++-- src/ajax/load.js | 4 +-- src/ajax/script.js | 4 +-- src/ajax/var/location.js | 2 +- src/ajax/var/nonce.js | 2 +- src/ajax/var/rquery.js | 2 +- src/ajax/xhr.js | 2 +- src/attributes.js | 4 +-- src/attributes/attr.js | 10 +++--- src/attributes/classes.js | 6 ++-- src/attributes/prop.js | 6 ++-- src/attributes/val.js | 8 ++--- src/callbacks.js | 8 ++--- src/core.js | 30 ++++++++-------- src/core/DOMEval.js | 6 ++-- src/core/access.js | 10 +++--- src/core/camelCase.js | 4 +-- src/core/init.js | 8 ++--- src/core/isArrayLike.js | 8 ++--- src/core/isAttached.js | 6 ++-- src/core/isObviousHtml.js | 4 +-- src/core/nodeName.js | 6 +--- src/core/parseHTML.js | 10 +++--- src/core/parseXML.js | 2 +- src/core/ready-no-deferred.js | 4 +-- src/core/ready.js | 4 +-- src/core/readyException.js | 2 +- src/core/stripAndCollapse.js | 6 ++-- src/core/toType.js | 8 ++--- src/core/var/rsingleTag.js | 2 +- src/css.js | 34 +++++++++--------- src/css/adjustCSS.js | 10 +++--- src/css/cssCamelCase.js | 6 ++-- src/css/curCSS.js | 14 ++++---- src/css/finalPropName.js | 6 ++-- src/css/hiddenVisibleSelectors.js | 2 +- src/css/isAutoPx.js | 4 +-- src/css/showHide.js | 10 +++--- src/css/support.js | 8 ++--- src/css/var/cssExpand.js | 2 +- src/css/var/getStyles.js | 2 +- src/css/var/isHiddenWithinTree.js | 4 +-- src/css/var/rcustomProp.js | 2 +- src/css/var/rnumnonpx.js | 4 +-- src/css/var/swap.js | 2 +- src/data.js | 12 +++---- src/data/Data.js | 12 +++---- src/data/var/acceptData.js | 2 +- src/data/var/dataPriv.js | 4 +-- src/data/var/dataUser.js | 4 +-- src/deferred.js | 6 ++-- src/deferred/exceptionHook.js | 2 +- src/deprecated.js | 6 ++-- src/deprecated/ajax-event-alias.js | 2 +- src/deprecated/event.js | 2 +- src/dimensions.js | 8 ++--- src/effects.js | 22 ++++++------ src/effects/Tween.js | 6 ++-- src/effects/animatedSelector.js | 2 +- src/event.js | 20 +++++------ src/event/trigger.js | 12 +++---- src/exports/amd.js | 2 +- src/exports/global.js | 2 +- src/jquery.js | 4 +-- src/manipulation.js | 30 ++++++++-------- src/manipulation/_evalUrl.js | 2 +- src/manipulation/buildFragment.js | 24 ++++++------- src/manipulation/domManip.js | 18 +++++----- src/manipulation/getAll.js | 8 ++--- src/manipulation/setGlobalEval.js | 6 ++-- src/manipulation/var/rscriptType.js | 2 +- src/manipulation/var/rtagName.js | 2 +- src/manipulation/wrapMap.js | 4 +-- src/offset.js | 10 +++--- src/queue.js | 6 ++-- src/queue/delay.js | 2 +- src/selector-native.js | 30 ++++++++-------- src/selector.js | 50 +++++++++++++------------- src/selector/createCache.js | 6 ++-- src/selector/escapeSelector.js | 2 +- src/selector/filterMatchExpr.js | 12 +++---- src/selector/preFilter.js | 14 ++++---- src/selector/rbuggyQSA.js | 10 +++--- src/selector/selectorError.js | 4 +-- src/selector/support.js | 6 ++-- src/selector/testContext.js | 4 +-- src/selector/toSelector.js | 4 +-- src/selector/tokenize.js | 18 +++++----- src/selector/unescapeSelector.js | 6 ++-- src/selector/uniqueSort.js | 10 +++--- src/selector/var/attributes.js | 6 ++-- src/selector/var/booleans.js | 4 +-- src/selector/var/identifier.js | 4 +-- src/selector/var/matches.js | 4 +-- src/selector/var/pseudos.js | 6 ++-- src/selector/var/rcomma.js | 4 +-- src/selector/var/rdescend.js | 4 +-- src/selector/var/rleadingCombinator.js | 6 ++-- src/selector/var/rpseudo.js | 4 +-- src/selector/var/rsibling.js | 2 +- src/serialize.js | 8 ++--- src/traversing.js | 16 ++++----- src/traversing/findFilter.js | 6 ++-- src/traversing/var/dir.js | 4 +-- src/traversing/var/rneedsContext.js | 4 +-- src/traversing/var/siblings.js | 2 +- src/var/ObjectFunctionString.js | 4 +-- src/var/arr.js | 2 +- src/var/class2type.js | 2 +- src/var/document.js | 2 +- src/var/documentElement.js | 4 +-- src/var/flat.js | 4 +-- src/var/fnToString.js | 4 +-- src/var/getProto.js | 2 +- src/var/hasOwn.js | 4 +-- src/var/indexOf.js | 4 +-- src/var/isIE.js | 4 +-- src/var/isWindow.js | 2 +- src/var/pnum.js | 2 +- src/var/pop.js | 4 +-- src/var/push.js | 4 +-- src/var/rcheckableType.js | 2 +- src/var/rcssNum.js | 4 +-- src/var/rnothtmlwhite.js | 2 +- src/var/rtrim.js | 4 +-- src/var/slice.js | 4 +-- src/var/sort.js | 4 +-- src/var/splice.js | 4 +-- src/var/support.js | 2 +- src/var/toString.js | 4 +-- src/var/whitespace.js | 2 +- src/wrap.js | 4 +-- test/jquery.js | 2 +- 136 files changed, 424 insertions(+), 478 deletions(-) diff --git a/build/tasks/build.js b/build/tasks/build.js index 79498d012..3fc37da8a 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -221,7 +221,7 @@ module.exports = function( grunt ) { // Remove the jQuery export from the entry file, we'll use our own // custom wrapper. setOverride( inputRollupOptions.input, - read( inputFileName ).replace( /\n*export default jQuery;\n*/, "\n" ) ); + read( inputFileName ).replace( /\n*export \{ jQuery, jQuery as \$ };\n*/, "\n" ) ); // Replace exports/global with a noop noConflict if ( excluded.includes( "exports/global" ) ) { diff --git a/src/ajax.js b/src/ajax.js index db4e30195..ab96c3625 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1,9 +1,9 @@ -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 { 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 "./core/parseXML.js"; @@ -874,4 +874,4 @@ jQuery.ajaxPrefilter( function( s ) { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/ajax/binary.js b/src/ajax/binary.js index f629c52f7..96fc5a469 100644 --- a/src/ajax/binary.js +++ b/src/ajax/binary.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../ajax.js"; diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index e115fdafc..add5a5c9c 100644 --- a/src/ajax/jsonp.js +++ b/src/ajax/jsonp.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import nonce from "./var/nonce.js"; -import rquery from "./var/rquery.js"; +import { jQuery } from "../core.js"; +import { nonce } from "./var/nonce.js"; +import { rquery } from "./var/rquery.js"; import "../ajax.js"; diff --git a/src/ajax/load.js b/src/ajax/load.js index 9a91b990b..044dc09dd 100644 --- a/src/ajax/load.js +++ b/src/ajax/load.js @@ -1,5 +1,5 @@ -import jQuery from "../core.js"; -import stripAndCollapse from "../core/stripAndCollapse.js"; +import { jQuery } from "../core.js"; +import { stripAndCollapse } from "../core/stripAndCollapse.js"; import "../core/parseHTML.js"; import "../ajax.js"; diff --git a/src/ajax/script.js b/src/ajax/script.js index aa8ddb4c5..3c88c1af3 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -1,5 +1,5 @@ -import jQuery from "../core.js"; -import document from "../var/document.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; import "../ajax.js"; diff --git a/src/ajax/var/location.js b/src/ajax/var/location.js index 78e6f07b3..316b19845 100644 --- a/src/ajax/var/location.js +++ b/src/ajax/var/location.js @@ -1 +1 @@ -export default window.location; +export var location = window.location; diff --git a/src/ajax/var/nonce.js b/src/ajax/var/nonce.js index b0070c699..9b3d3e83a 100644 --- a/src/ajax/var/nonce.js +++ b/src/ajax/var/nonce.js @@ -1 +1 @@ -export default { guid: Date.now() }; +export var nonce = { guid: Date.now() }; diff --git a/src/ajax/var/rquery.js b/src/ajax/var/rquery.js index f18f87661..e694e8255 100644 --- a/src/ajax/var/rquery.js +++ b/src/ajax/var/rquery.js @@ -1 +1 @@ -export default ( /\?/ ); +export var rquery = /\?/; diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 528a5c748..c7b057a6e 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../ajax.js"; diff --git a/src/attributes.js b/src/attributes.js index 646107adc..278d51306 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,4 +1,4 @@ -import jQuery from "./core.js"; +import { jQuery } from "./core.js"; import "./attributes/attr.js"; import "./attributes/prop.js"; @@ -6,4 +6,4 @@ import "./attributes/classes.js"; import "./attributes/val.js"; // Return jQuery for attributes-only inclusion -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/attributes/attr.js b/src/attributes/attr.js index d6d497735..fb6c3bd7b 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -1,8 +1,8 @@ -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"; +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"; import "../selector.js"; diff --git a/src/attributes/classes.js b/src/attributes/classes.js index 5e64ea2ae..fa2b7d9cd 100644 --- a/src/attributes/classes.js +++ b/src/attributes/classes.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import stripAndCollapse from "../core/stripAndCollapse.js"; -import rnothtmlwhite from "../var/rnothtmlwhite.js"; +import { jQuery } from "../core.js"; +import { stripAndCollapse } from "../core/stripAndCollapse.js"; +import { rnothtmlwhite } from "../var/rnothtmlwhite.js"; import "../core/init.js"; diff --git a/src/attributes/prop.js b/src/attributes/prop.js index 3c180593f..f889e5373 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import access from "../core/access.js"; -import isIE from "../var/isIE.js"; +import { jQuery } from "../core.js"; +import { access } from "../core/access.js"; +import { isIE } from "../var/isIE.js"; import "../selector.js"; diff --git a/src/attributes/val.js b/src/attributes/val.js index 536ed88a4..34d1669fc 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -1,7 +1,7 @@ -import jQuery from "../core.js"; -import isIE from "../var/isIE.js"; -import stripAndCollapse from "../core/stripAndCollapse.js"; -import nodeName from "../core/nodeName.js"; +import { jQuery } from "../core.js"; +import { isIE } from "../var/isIE.js"; +import { stripAndCollapse } from "../core/stripAndCollapse.js"; +import { nodeName } from "../core/nodeName.js"; import "../core/init.js"; diff --git a/src/callbacks.js b/src/callbacks.js index 19b3d7c1c..e4f05e798 100644 --- a/src/callbacks.js +++ b/src/callbacks.js @@ -1,6 +1,6 @@ -import jQuery from "./core.js"; -import toType from "./core/toType.js"; -import rnothtmlwhite from "./var/rnothtmlwhite.js"; +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 ) { @@ -227,4 +227,4 @@ jQuery.Callbacks = function( options ) { return self; }; -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/core.js b/src/core.js index 8ed56b7e8..c79455507 100644 --- a/src/core.js +++ b/src/core.js @@ -1,17 +1,17 @@ -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 isArrayLike from "./core/isArrayLike.js"; -import DOMEval from "./core/DOMEval.js"; +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 { isArrayLike } from "./core/isArrayLike.js"; +import { DOMEval } from "./core/DOMEval.js"; var version = "@VERSION", @@ -416,4 +416,4 @@ jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symb class2type[ "[object " + name + "]" ] = name.toLowerCase(); } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/core/DOMEval.js b/src/core/DOMEval.js index 059464188..806f29ebe 100644 --- a/src/core/DOMEval.js +++ b/src/core/DOMEval.js @@ -1,4 +1,4 @@ -import document from "../var/document.js"; +import { document } from "../var/document.js"; var preservedScriptAttributes = { type: true, @@ -7,7 +7,7 @@ var preservedScriptAttributes = { noModule: true }; -function DOMEval( code, node, doc ) { +export function DOMEval( code, node, doc ) { doc = doc || document; var i, @@ -23,5 +23,3 @@ function DOMEval( code, node, doc ) { } doc.head.appendChild( script ).parentNode.removeChild( script ); } - -export default DOMEval; diff --git a/src/core/access.js b/src/core/access.js index 6b717b9ba..86bac126c 100644 --- a/src/core/access.js +++ b/src/core/access.js @@ -1,9 +1,9 @@ -import jQuery from "../core.js"; -import toType from "../core/toType.js"; +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 -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { +export function access( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, len = elems.length, bulk = key == null; @@ -60,6 +60,4 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { } return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - -export default access; +} diff --git a/src/core/camelCase.js b/src/core/camelCase.js index f12a2c67d..dca86fc33 100644 --- a/src/core/camelCase.js +++ b/src/core/camelCase.js @@ -7,8 +7,6 @@ function fcamelCase( _all, letter ) { } // Convert dashed to camelCase -function camelCase( string ) { +export function camelCase( string ) { return string.replace( rdashAlpha, fcamelCase ); } - -export default camelCase; diff --git a/src/core/init.js b/src/core/init.js index 4ac091054..9c9454726 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -1,8 +1,8 @@ // Initialize a jQuery object -import jQuery from "../core.js"; -import document from "../var/document.js"; -import rsingleTag from "./var/rsingleTag.js"; -import isObviousHtml from "./isObviousHtml.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; +import { rsingleTag } from "./var/rsingleTag.js"; +import { isObviousHtml } from "./isObviousHtml.js"; import "../traversing/findFilter.js"; diff --git a/src/core/isArrayLike.js b/src/core/isArrayLike.js index 988c483d3..bc24b32f4 100644 --- a/src/core/isArrayLike.js +++ b/src/core/isArrayLike.js @@ -1,7 +1,7 @@ -import toType from "./toType.js"; -import isWindow from "../var/isWindow.js"; +import { toType } from "./toType.js"; +import { isWindow } from "../var/isWindow.js"; -function isArrayLike( obj ) { +export function isArrayLike( obj ) { var length = !!obj && obj.length, type = toType( obj ); @@ -13,5 +13,3 @@ function isArrayLike( obj ) { return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } - -export default isArrayLike; diff --git a/src/core/isAttached.js b/src/core/isAttached.js index 72c7bbda4..12a60ee92 100644 --- a/src/core/isAttached.js +++ b/src/core/isAttached.js @@ -1,5 +1,5 @@ -import jQuery from "../core.js"; -import documentElement from "../var/documentElement.js"; +import { jQuery } from "../core.js"; +import { documentElement } from "../var/documentElement.js"; var isAttached = function( elem ) { return jQuery.contains( elem.ownerDocument, elem ) || @@ -16,4 +16,4 @@ if ( !documentElement.getRootNode ) { }; } -export default isAttached; +export { isAttached }; diff --git a/src/core/isObviousHtml.js b/src/core/isObviousHtml.js index 976f81219..715b47c1b 100644 --- a/src/core/isObviousHtml.js +++ b/src/core/isObviousHtml.js @@ -1,7 +1,5 @@ -function isObviousHtml( input ) { +export function isObviousHtml( input ) { return input[ 0 ] === "<" && input[ input.length - 1 ] === ">" && input.length >= 3; } - -export default isObviousHtml; diff --git a/src/core/nodeName.js b/src/core/nodeName.js index ac90c6075..014672b87 100644 --- a/src/core/nodeName.js +++ b/src/core/nodeName.js @@ -1,7 +1,3 @@ -function nodeName( elem, name ) { - +export function nodeName( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - } - -export default nodeName; diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js index b522a5f7b..6de02e8b6 100644 --- a/src/core/parseHTML.js +++ b/src/core/parseHTML.js @@ -1,8 +1,8 @@ -import jQuery from "../core.js"; -import document from "../var/document.js"; -import rsingleTag from "./var/rsingleTag.js"; -import buildFragment from "../manipulation/buildFragment.js"; -import isObviousHtml from "./isObviousHtml.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; +import { rsingleTag } from "./var/rsingleTag.js"; +import { buildFragment } from "../manipulation/buildFragment.js"; +import { isObviousHtml } from "./isObviousHtml.js"; // Argument "data" should be string of html or a TrustedHTML wrapper of obvious HTML // context (optional): If specified, the fragment will be created in this context, diff --git a/src/core/parseXML.js b/src/core/parseXML.js index 482545aaf..fa1b94c00 100644 --- a/src/core/parseXML.js +++ b/src/core/parseXML.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; // Cross-browser xml parsing jQuery.parseXML = function( data ) { diff --git a/src/core/ready-no-deferred.js b/src/core/ready-no-deferred.js index 17aaf5bcd..e46ecacd1 100644 --- a/src/core/ready-no-deferred.js +++ b/src/core/ready-no-deferred.js @@ -1,5 +1,5 @@ -import jQuery from "../core.js"; -import document from "../var/document.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; var readyCallbacks = [], whenReady = function( fn ) { diff --git a/src/core/ready.js b/src/core/ready.js index 88dcc3433..5265a52b0 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -1,5 +1,5 @@ -import jQuery from "../core.js"; -import document from "../var/document.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; import "../core/readyException.js"; import "../deferred.js"; diff --git a/src/core/readyException.js b/src/core/readyException.js index 1b5512c15..ff5296a3c 100644 --- a/src/core/readyException.js +++ b/src/core/readyException.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; jQuery.readyException = function( error ) { window.setTimeout( function() { diff --git a/src/core/stripAndCollapse.js b/src/core/stripAndCollapse.js index 944a79362..c9a73c6fa 100644 --- a/src/core/stripAndCollapse.js +++ b/src/core/stripAndCollapse.js @@ -1,10 +1,8 @@ -import rnothtmlwhite from "../var/rnothtmlwhite.js"; +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 ) { +export function stripAndCollapse( value ) { var tokens = value.match( rnothtmlwhite ) || []; return tokens.join( " " ); } - -export default stripAndCollapse; diff --git a/src/core/toType.js b/src/core/toType.js index 67af8a67f..9df6c02a4 100644 --- a/src/core/toType.js +++ b/src/core/toType.js @@ -1,7 +1,7 @@ -import class2type from "../var/class2type.js"; -import toString from "../var/toString.js"; +import { class2type } from "../var/class2type.js"; +import { toString } from "../var/toString.js"; -function toType( obj ) { +export function toType( obj ) { if ( obj == null ) { return obj + ""; } @@ -10,5 +10,3 @@ function toType( obj ) { class2type[ toString.call( obj ) ] || "object" : typeof obj; } - -export default toType; diff --git a/src/core/var/rsingleTag.js b/src/core/var/rsingleTag.js index 5bf52d568..8cead250f 100644 --- a/src/core/var/rsingleTag.js +++ b/src/core/var/rsingleTag.js @@ -1,3 +1,3 @@ // 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 ); +export var rsingleTag = /^<([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 a69ad1730..f5407470f 100644 --- a/src/css.js +++ b/src/css.js @@ -1,19 +1,19 @@ -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 rcustomProp from "./css/var/rcustomProp.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 finalPropName from "./css/finalPropName.js"; -import support from "./css/support.js"; +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 { rcustomProp } from "./css/var/rcustomProp.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 { finalPropName } from "./css/finalPropName.js"; +import { support } from "./css/support.js"; import "./core/init.js"; import "./core/ready.js"; @@ -418,4 +418,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/css/adjustCSS.js b/src/css/adjustCSS.js index d973ff386..a5263f099 100644 --- a/src/css/adjustCSS.js +++ b/src/css/adjustCSS.js @@ -1,8 +1,8 @@ -import jQuery from "../core.js"; -import isAutoPx from "./isAutoPx.js"; -import rcssNum from "../var/rcssNum.js"; +import { jQuery } from "../core.js"; +import { isAutoPx } from "./isAutoPx.js"; +import { rcssNum } from "../var/rcssNum.js"; -function adjustCSS( elem, prop, valueParts, tween ) { +export function adjustCSS( elem, prop, valueParts, tween ) { var adjusted, scale, maxIterations = 20, currentValue = tween ? @@ -66,5 +66,3 @@ function adjustCSS( elem, prop, valueParts, tween ) { } return adjusted; } - -export default adjustCSS; diff --git a/src/css/cssCamelCase.js b/src/css/cssCamelCase.js index c75dcd950..a87897989 100644 --- a/src/css/cssCamelCase.js +++ b/src/css/cssCamelCase.js @@ -1,4 +1,4 @@ -import camelCase from "../core/camelCase.js"; +import { camelCase } from "../core/camelCase.js"; // Matches dashed string for camelizing var rmsPrefix = /^-ms-/; @@ -7,8 +7,6 @@ var rmsPrefix = /^-ms-/; // Used by the css & effects modules. // Support: IE <=9 - 11+ // Microsoft forgot to hump their vendor prefix (trac-9572) -function cssCamelCase( string ) { +export function cssCamelCase( string ) { return camelCase( string.replace( rmsPrefix, "ms-" ) ); } - -export default cssCamelCase; diff --git a/src/css/curCSS.js b/src/css/curCSS.js index 72c3db9f5..06394f315 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -1,10 +1,10 @@ -import jQuery from "../core.js"; -import isAttached from "../core/isAttached.js"; -import getStyles from "./var/getStyles.js"; -import rcustomProp from "./var/rcustomProp.js"; -import rtrim from "../var/rtrim.js"; +import { jQuery } from "../core.js"; +import { isAttached } from "../core/isAttached.js"; +import { getStyles } from "./var/getStyles.js"; +import { rcustomProp } from "./var/rcustomProp.js"; +import { rtrim } from "../var/rtrim.js"; -function curCSS( elem, name, computed ) { +export function curCSS( elem, name, computed ) { var ret, isCustomProp = rcustomProp.test( name ); @@ -57,5 +57,3 @@ function curCSS( elem, name, computed ) { ret + "" : ret; } - -export default curCSS; diff --git a/src/css/finalPropName.js b/src/css/finalPropName.js index 40d2fb193..b11e92394 100644 --- a/src/css/finalPropName.js +++ b/src/css/finalPropName.js @@ -1,4 +1,4 @@ -import document from "../var/document.js"; +import { document } from "../var/document.js"; var cssPrefixes = [ "Webkit", "Moz", "ms" ], emptyStyle = document.createElement( "div" ).style, @@ -20,7 +20,7 @@ function vendorPropName( name ) { } // Return a potentially-mapped vendor prefixed property -function finalPropName( name ) { +export function finalPropName( name ) { var final = vendorProps[ name ]; if ( final ) { @@ -31,5 +31,3 @@ function finalPropName( name ) { } return vendorProps[ name ] = vendorPropName( name ) || name; } - -export default finalPropName; diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index 1f892dfe0..5e0709481 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../selector.js"; diff --git a/src/css/isAutoPx.js b/src/css/isAutoPx.js index ca9b35aca..96501be01 100644 --- a/src/css/isAutoPx.js +++ b/src/css/isAutoPx.js @@ -23,7 +23,7 @@ var ralphaStart = /^[a-z]/, // \ Max / \ Height / rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/; -function isAutoPx( prop ) { +export function isAutoPx( prop ) { // The first test is used to ensure that: // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex). @@ -31,5 +31,3 @@ function isAutoPx( prop ) { return ralphaStart.test( prop ) && rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) ); } - -export default isAutoPx; diff --git a/src/css/showHide.js b/src/css/showHide.js index dc273f98c..77ddc5bdb 100644 --- a/src/css/showHide.js +++ b/src/css/showHide.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import dataPriv from "../data/var/dataPriv.js"; -import isHiddenWithinTree from "../css/var/isHiddenWithinTree.js"; +import { jQuery } from "../core.js"; +import { dataPriv } from "../data/var/dataPriv.js"; +import { isHiddenWithinTree } from "../css/var/isHiddenWithinTree.js"; var defaultDisplayMap = {}; @@ -27,7 +27,7 @@ function getDefaultDisplay( elem ) { return display; } -function showHide( elements, show ) { +export function showHide( elements, show ) { var display, elem, values = [], index = 0, @@ -96,5 +96,3 @@ jQuery.fn.extend( { } ); } } ); - -export default showHide; diff --git a/src/css/support.js b/src/css/support.js index cf9f0cfcd..5f9b37d7f 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -1,6 +1,6 @@ -import document from "../var/document.js"; -import documentElement from "../var/documentElement.js"; -import support from "../var/support.js"; +import { document } from "../var/document.js"; +import { documentElement } from "../var/documentElement.js"; +import { support } from "../var/support.js"; ( function() { @@ -58,4 +58,4 @@ support.reliableTrDimensions = function() { }; } )(); -export default support; +export { support }; diff --git a/src/css/var/cssExpand.js b/src/css/var/cssExpand.js index 66062e2ee..10f4e89d2 100644 --- a/src/css/var/cssExpand.js +++ b/src/css/var/cssExpand.js @@ -1 +1 @@ -export default [ "Top", "Right", "Bottom", "Left" ]; +export var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; diff --git a/src/css/var/getStyles.js b/src/css/var/getStyles.js index d25af6752..9dc4298d5 100644 --- a/src/css/var/getStyles.js +++ b/src/css/var/getStyles.js @@ -1,4 +1,4 @@ -export default function( elem ) { +export function getStyles( elem ) { // Support: IE <=11+ (trac-14150) // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )` diff --git a/src/css/var/isHiddenWithinTree.js b/src/css/var/isHiddenWithinTree.js index c88747827..22b8221f9 100644 --- a/src/css/var/isHiddenWithinTree.js +++ b/src/css/var/isHiddenWithinTree.js @@ -1,4 +1,4 @@ -import jQuery from "../../core.js"; +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. @@ -7,7 +7,7 @@ import jQuery from "../../core.js"; // * 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 ) { +export function isHiddenWithinTree( elem, el ) { // isHiddenWithinTree might be called from jQuery#filter function; // in that case, element will be second argument diff --git a/src/css/var/rcustomProp.js b/src/css/var/rcustomProp.js index f435e7cd7..18b8686c4 100644 --- a/src/css/var/rcustomProp.js +++ b/src/css/var/rcustomProp.js @@ -1 +1 @@ -export default ( /^--/ ); +export var rcustomProp = /^--/; diff --git a/src/css/var/rnumnonpx.js b/src/css/var/rnumnonpx.js index 18a9dad6c..0386b0054 100644 --- a/src/css/var/rnumnonpx.js +++ b/src/css/var/rnumnonpx.js @@ -1,3 +1,3 @@ -import pnum from "../../var/pnum.js"; +import { pnum } from "../../var/pnum.js"; -export default new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); +export var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); diff --git a/src/css/var/swap.js b/src/css/var/swap.js index f5d8f23ab..90b31d584 100644 --- a/src/css/var/swap.js +++ b/src/css/var/swap.js @@ -1,5 +1,5 @@ // A method for quickly swapping in/out CSS properties to get correct calculations. -export default function( elem, options, callback ) { +export function swap( elem, options, callback ) { var ret, name, old = {}; diff --git a/src/data.js b/src/data.js index e3e8eabe1..ce2813e97 100644 --- a/src/data.js +++ b/src/data.js @@ -1,8 +1,8 @@ -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"; +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 // @@ -172,4 +172,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/data/Data.js b/src/data/Data.js index 8c9e1f9f8..2a3ccbd14 100644 --- a/src/data/Data.js +++ b/src/data/Data.js @@ -1,9 +1,9 @@ -import jQuery from "../core.js"; -import camelCase from "../core/camelCase.js"; -import rnothtmlwhite from "../var/rnothtmlwhite.js"; -import acceptData from "./var/acceptData.js"; +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() { +export function Data() { this.expando = jQuery.expando + Data.uid++; } @@ -153,5 +153,3 @@ Data.prototype = { return cache !== undefined && !jQuery.isEmptyObject( cache ); } }; - -export default Data; diff --git a/src/data/var/acceptData.js b/src/data/var/acceptData.js index 6b154c5b3..dbb93ee92 100644 --- a/src/data/var/acceptData.js +++ b/src/data/var/acceptData.js @@ -1,7 +1,7 @@ /** * Determines whether an object can have data */ -export default function( owner ) { +export function acceptData( owner ) { // Accepts only: // - Node diff --git a/src/data/var/dataPriv.js b/src/data/var/dataPriv.js index 94ea1190e..aaa43bd4e 100644 --- a/src/data/var/dataPriv.js +++ b/src/data/var/dataPriv.js @@ -1,3 +1,3 @@ -import Data from "../Data.js"; +import { Data } from "../Data.js"; -export default new Data(); +export var dataPriv = new Data(); diff --git a/src/data/var/dataUser.js b/src/data/var/dataUser.js index 94ea1190e..a0504b628 100644 --- a/src/data/var/dataUser.js +++ b/src/data/var/dataUser.js @@ -1,3 +1,3 @@ -import Data from "../Data.js"; +import { Data } from "../Data.js"; -export default new Data(); +export var dataUser = new Data(); diff --git a/src/deferred.js b/src/deferred.js index 0d77ac9d6..5817ddbc6 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -1,5 +1,5 @@ -import jQuery from "./core.js"; -import slice from "./var/slice.js"; +import { jQuery } from "./core.js"; +import { slice } from "./var/slice.js"; import "./callbacks.js"; @@ -389,4 +389,4 @@ jQuery.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/deferred/exceptionHook.js b/src/deferred/exceptionHook.js index a5e7b5d3c..4967a273d 100644 --- a/src/deferred/exceptionHook.js +++ b/src/deferred/exceptionHook.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../deferred.js"; diff --git a/src/deprecated.js b/src/deprecated.js index e58156f9e..b2f767cdf 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -1,5 +1,5 @@ -import jQuery from "./core.js"; -import slice from "./var/slice.js"; +import { jQuery } from "./core.js"; +import { slice } from "./var/slice.js"; import "./deprecated/ajax-event-alias.js"; import "./deprecated/event.js"; @@ -42,3 +42,5 @@ jQuery.holdReady = function( hold ) { jQuery.ready( true ); } }; + +export { jQuery, jQuery as $ }; diff --git a/src/deprecated/ajax-event-alias.js b/src/deprecated/ajax-event-alias.js index e4fe11525..134b4f63d 100644 --- a/src/deprecated/ajax-event-alias.js +++ b/src/deprecated/ajax-event-alias.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../ajax.js"; import "../event.js"; diff --git a/src/deprecated/event.js b/src/deprecated/event.js index 4f5c59c0a..f481a9c1f 100644 --- a/src/deprecated/event.js +++ b/src/deprecated/event.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../event.js"; import "../event/trigger.js"; diff --git a/src/dimensions.js b/src/dimensions.js index 42e445362..a5e1a6126 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -1,6 +1,6 @@ -import jQuery from "./core.js"; -import access from "./core/access.js"; -import isWindow from "./var/isWindow.js"; +import { jQuery } from "./core.js"; +import { access } from "./core/access.js"; +import { isWindow } from "./var/isWindow.js"; import "./css.js"; @@ -53,4 +53,4 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { } ); } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/effects.js b/src/effects.js index 49b0bf67d..99dbad7bc 100644 --- a/src/effects.js +++ b/src/effects.js @@ -1,13 +1,13 @@ -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 { 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"; @@ -684,4 +684,4 @@ jQuery.fx.speeds = { _default: 400 }; -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/effects/Tween.js b/src/effects/Tween.js index c0220bd10..7acd2792c 100644 --- a/src/effects/Tween.js +++ b/src/effects/Tween.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import isAutoPx from "../css/isAutoPx.js"; -import finalPropName from "../css/finalPropName.js"; +import { jQuery } from "../core.js"; +import { isAutoPx } from "../css/isAutoPx.js"; +import { finalPropName } from "../css/finalPropName.js"; import "../css.js"; diff --git a/src/effects/animatedSelector.js b/src/effects/animatedSelector.js index 327956f72..0e0b377f1 100644 --- a/src/effects/animatedSelector.js +++ b/src/effects/animatedSelector.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../selector.js"; import "../effects.js"; diff --git a/src/event.js b/src/event.js index 5d2c8c1c3..0112264a4 100644 --- a/src/event.js +++ b/src/event.js @@ -1,12 +1,12 @@ -import jQuery from "./core.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 isIE from "./var/isIE.js"; -import acceptData from "./data/var/acceptData.js"; -import dataPriv from "./data/var/dataPriv.js"; -import nodeName from "./core/nodeName.js"; +import { jQuery } from "./core.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 { isIE } from "./var/isIE.js"; +import { acceptData } from "./data/var/acceptData.js"; +import { dataPriv } from "./data/var/dataPriv.js"; +import { nodeName } from "./core/nodeName.js"; import "./core/init.js"; import "./selector.js"; @@ -851,4 +851,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/event/trigger.js b/src/event/trigger.js index 5fad460e1..2b1f52846 100644 --- a/src/event/trigger.js +++ b/src/event/trigger.js @@ -1,9 +1,9 @@ -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 { 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"; diff --git a/src/exports/amd.js b/src/exports/amd.js index 44587ab3a..85a66eeab 100644 --- a/src/exports/amd.js +++ b/src/exports/amd.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +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 diff --git a/src/exports/global.js b/src/exports/global.js index 965a4b400..3adcb739e 100644 --- a/src/exports/global.js +++ b/src/exports/global.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; var diff --git a/src/jquery.js b/src/jquery.js index d833516d4..e763d1b05 100644 --- a/src/jquery.js +++ b/src/jquery.js @@ -1,4 +1,4 @@ -import jQuery from "./core.js"; +import { jQuery } from "./core.js"; import "./selector.js"; import "./traversing.js"; @@ -35,4 +35,4 @@ import "./deprecated.js"; import "./exports/amd.js"; import "./exports/global.js"; -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/manipulation.js b/src/manipulation.js index d3ee1130f..0a7209412 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -1,17 +1,17 @@ -import jQuery from "./core.js"; -import isAttached from "./core/isAttached.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 wrapMap from "./manipulation/wrapMap.js"; -import getAll from "./manipulation/getAll.js"; -import domManip from "./manipulation/domManip.js"; -import setGlobalEval from "./manipulation/setGlobalEval.js"; -import dataPriv from "./data/var/dataPriv.js"; -import dataUser from "./data/var/dataUser.js"; -import acceptData from "./data/var/acceptData.js"; -import nodeName from "./core/nodeName.js"; +import { jQuery } from "./core.js"; +import { isAttached } from "./core/isAttached.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 { wrapMap } from "./manipulation/wrapMap.js"; +import { getAll } from "./manipulation/getAll.js"; +import { domManip } from "./manipulation/domManip.js"; +import { setGlobalEval } from "./manipulation/setGlobalEval.js"; +import { dataPriv } from "./data/var/dataPriv.js"; +import { dataUser } from "./data/var/dataUser.js"; +import { acceptData } from "./data/var/acceptData.js"; +import { nodeName } from "./core/nodeName.js"; import "./core/init.js"; import "./traversing.js"; @@ -341,4 +341,4 @@ jQuery.each( { }; } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/manipulation/_evalUrl.js b/src/manipulation/_evalUrl.js index 1af889ddc..e07bb8d72 100644 --- a/src/manipulation/_evalUrl.js +++ b/src/manipulation/_evalUrl.js @@ -1,4 +1,4 @@ -import jQuery from "../ajax.js"; +import { jQuery } from "../ajax.js"; jQuery._evalUrl = function( url, options, doc ) { return jQuery.ajax( { diff --git a/src/manipulation/buildFragment.js b/src/manipulation/buildFragment.js index dd0d673e6..034ba89f4 100644 --- a/src/manipulation/buildFragment.js +++ b/src/manipulation/buildFragment.js @@ -1,17 +1,17 @@ -import jQuery from "../core.js"; -import toType from "../core/toType.js"; -import isAttached from "../core/isAttached.js"; -import arr from "../var/arr.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"; -import isArrayLike from "../core/isArrayLike.js"; +import { jQuery } from "../core.js"; +import { toType } from "../core/toType.js"; +import { isAttached } from "../core/isAttached.js"; +import { arr } from "../var/arr.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"; +import { isArrayLike } from "../core/isArrayLike.js"; var rhtml = /<|&#?\w+;/; -function buildFragment( elems, context, scripts, selection, ignored ) { +export function buildFragment( elems, context, scripts, selection, ignored ) { var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], @@ -95,5 +95,3 @@ function buildFragment( elems, context, scripts, selection, ignored ) { return fragment; } - -export default buildFragment; diff --git a/src/manipulation/domManip.js b/src/manipulation/domManip.js index 65856a67d..39c146c89 100644 --- a/src/manipulation/domManip.js +++ b/src/manipulation/domManip.js @@ -1,10 +1,10 @@ -import jQuery from "../core.js"; -import flat from "../var/flat.js"; -import rscriptType from "./var/rscriptType.js"; -import getAll from "./getAll.js"; -import buildFragment from "./buildFragment.js"; -import dataPriv from "../data/var/dataPriv.js"; -import DOMEval from "../core/DOMEval.js"; +import { jQuery } from "../core.js"; +import { flat } from "../var/flat.js"; +import { rscriptType } from "./var/rscriptType.js"; +import { getAll } from "./getAll.js"; +import { buildFragment } from "./buildFragment.js"; +import { dataPriv } from "../data/var/dataPriv.js"; +import { DOMEval } from "../core/DOMEval.js"; // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { @@ -21,7 +21,7 @@ function restoreScript( elem ) { return elem; } -function domManip( collection, args, callback, ignored ) { +export function domManip( collection, args, callback, ignored ) { // Flatten any nested arrays args = flat( args ); @@ -105,5 +105,3 @@ function domManip( collection, args, callback, ignored ) { return collection; } - -export default domManip; diff --git a/src/manipulation/getAll.js b/src/manipulation/getAll.js index f4943dfe4..db876202d 100644 --- a/src/manipulation/getAll.js +++ b/src/manipulation/getAll.js @@ -1,7 +1,7 @@ -import jQuery from "../core.js"; -import nodeName from "../core/nodeName.js"; +import { jQuery } from "../core.js"; +import { nodeName } from "../core/nodeName.js"; -function getAll( context, tag ) { +export function getAll( context, tag ) { // Support: IE <=9 - 11+ // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) @@ -23,5 +23,3 @@ function getAll( context, tag ) { return ret; } - -export default getAll; diff --git a/src/manipulation/setGlobalEval.js b/src/manipulation/setGlobalEval.js index c6f7ee9ab..9571bdcfa 100644 --- a/src/manipulation/setGlobalEval.js +++ b/src/manipulation/setGlobalEval.js @@ -1,7 +1,7 @@ -import dataPriv from "../data/var/dataPriv.js"; +import { dataPriv } from "../data/var/dataPriv.js"; // Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { +export function setGlobalEval( elems, refElements ) { var i = 0, l = elems.length; @@ -13,5 +13,3 @@ function setGlobalEval( elems, refElements ) { ); } } - -export default setGlobalEval; diff --git a/src/manipulation/var/rscriptType.js b/src/manipulation/var/rscriptType.js index 879651c7c..e3977e94e 100644 --- a/src/manipulation/var/rscriptType.js +++ b/src/manipulation/var/rscriptType.js @@ -1 +1 @@ -export default ( /^$|^module$|\/(?:java|ecma)script/i ); +export var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; diff --git a/src/manipulation/var/rtagName.js b/src/manipulation/var/rtagName.js index b35acc999..fceba6720 100644 --- a/src/manipulation/var/rtagName.js +++ b/src/manipulation/var/rtagName.js @@ -1,4 +1,4 @@ // 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 ); +export var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; diff --git a/src/manipulation/wrapMap.js b/src/manipulation/wrapMap.js index 457902595..a69bcec86 100644 --- a/src/manipulation/wrapMap.js +++ b/src/manipulation/wrapMap.js @@ -1,4 +1,4 @@ -var wrapMap = { +export var wrapMap = { // Table parts need to be wrapped with `` or they're // stripped to their contents when put in a div. @@ -13,5 +13,3 @@ var wrapMap = { wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; - -export default wrapMap; diff --git a/src/offset.js b/src/offset.js index 7d98083b9..5a9d3c32e 100644 --- a/src/offset.js +++ b/src/offset.js @@ -1,7 +1,7 @@ -import jQuery from "./core.js"; -import access from "./core/access.js"; -import documentElement from "./var/documentElement.js"; -import isWindow from "./var/isWindow.js"; +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"; @@ -198,4 +198,4 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( }; } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/queue.js b/src/queue.js index 0028d7e7f..3621eaf45 100644 --- a/src/queue.js +++ b/src/queue.js @@ -1,5 +1,5 @@ -import jQuery from "./core.js"; -import dataPriv from "./data/var/dataPriv.js"; +import { jQuery } from "./core.js"; +import { dataPriv } from "./data/var/dataPriv.js"; import "./deferred.js"; import "./callbacks.js"; @@ -138,4 +138,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/queue/delay.js b/src/queue/delay.js index 79c2aca80..f2b8d9cd0 100644 --- a/src/queue/delay.js +++ b/src/queue/delay.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; import "../queue.js"; import "../effects.js"; // Delay is optional because of this dependency diff --git a/src/selector-native.js b/src/selector-native.js index 5eb582cfd..afb60f227 100644 --- a/src/selector-native.js +++ b/src/selector-native.js @@ -21,20 +21,20 @@ * needs. */ -import jQuery from "./core.js"; -import document from "./var/document.js"; -import whitespace from "./var/whitespace.js"; -import isIE from "./var/isIE.js"; -import booleans from "./selector/var/booleans.js"; -import rleadingCombinator from "./selector/var/rleadingCombinator.js"; -import rdescend from "./selector/var/rdescend.js"; -import rsibling from "./selector/var/rsibling.js"; -import matches from "./selector/var/matches.js"; -import testContext from "./selector/testContext.js"; -import filterMatchExpr from "./selector/filterMatchExpr.js"; -import preFilter from "./selector/preFilter.js"; -import tokenize from "./selector/tokenize.js"; -import toSelector from "./selector/toSelector.js"; +import { jQuery } from "./core.js"; +import { document } from "./var/document.js"; +import { whitespace } from "./var/whitespace.js"; +import { isIE } from "./var/isIE.js"; +import { booleans } from "./selector/var/booleans.js"; +import { rleadingCombinator } from "./selector/var/rleadingCombinator.js"; +import { rdescend } from "./selector/var/rdescend.js"; +import { rsibling } from "./selector/var/rsibling.js"; +import { matches } from "./selector/var/matches.js"; +import { testContext } from "./selector/testContext.js"; +import { filterMatchExpr } from "./selector/filterMatchExpr.js"; +import { preFilter } from "./selector/preFilter.js"; +import { tokenize } from "./selector/tokenize.js"; +import { toSelector } from "./selector/toSelector.js"; // The following utils are attached directly to the jQuery object. import "./selector/escapeSelector.js"; @@ -145,3 +145,5 @@ jQuery.extend( jQuery.find, { }, tokenize: tokenize } ); + +export { jQuery, jQuery as $ }; diff --git a/src/selector.js b/src/selector.js index 52e975c90..92bfcfed3 100644 --- a/src/selector.js +++ b/src/selector.js @@ -1,27 +1,27 @@ -import jQuery from "./core.js"; -import nodeName from "./core/nodeName.js"; -import document from "./var/document.js"; -import indexOf from "./var/indexOf.js"; -import pop from "./var/pop.js"; -import push from "./var/push.js"; -import whitespace from "./var/whitespace.js"; -import rbuggyQSA from "./selector/rbuggyQSA.js"; -import rtrim from "./var/rtrim.js"; -import isIE from "./var/isIE.js"; -import identifier from "./selector/var/identifier.js"; -import booleans from "./selector/var/booleans.js"; -import rleadingCombinator from "./selector/var/rleadingCombinator.js"; -import rdescend from "./selector/var/rdescend.js"; -import rsibling from "./selector/var/rsibling.js"; -import matches from "./selector/var/matches.js"; -import createCache from "./selector/createCache.js"; -import testContext from "./selector/testContext.js"; -import filterMatchExpr from "./selector/filterMatchExpr.js"; -import preFilter from "./selector/preFilter.js"; -import selectorError from "./selector/selectorError.js"; -import unescapeSelector from "./selector/unescapeSelector.js"; -import tokenize from "./selector/tokenize.js"; -import toSelector from "./selector/toSelector.js"; +import { jQuery } from "./core.js"; +import { nodeName } from "./core/nodeName.js"; +import { document } from "./var/document.js"; +import { indexOf } from "./var/indexOf.js"; +import { pop } from "./var/pop.js"; +import { push } from "./var/push.js"; +import { whitespace } from "./var/whitespace.js"; +import { rbuggyQSA } from "./selector/rbuggyQSA.js"; +import { rtrim } from "./var/rtrim.js"; +import { isIE } from "./var/isIE.js"; +import { identifier } from "./selector/var/identifier.js"; +import { booleans } from "./selector/var/booleans.js"; +import { rleadingCombinator } from "./selector/var/rleadingCombinator.js"; +import { rdescend } from "./selector/var/rdescend.js"; +import { rsibling } from "./selector/var/rsibling.js"; +import { matches } from "./selector/var/matches.js"; +import { createCache } from "./selector/createCache.js"; +import { testContext } from "./selector/testContext.js"; +import { filterMatchExpr } from "./selector/filterMatchExpr.js"; +import { preFilter } from "./selector/preFilter.js"; +import { selectorError } from "./selector/selectorError.js"; +import { unescapeSelector } from "./selector/unescapeSelector.js"; +import { tokenize } from "./selector/tokenize.js"; +import { toSelector } from "./selector/toSelector.js"; // The following utils are attached directly to the jQuery object. import "./selector/escapeSelector.js"; @@ -1370,3 +1370,5 @@ find.setDocument = setDocument; find.tokenize = tokenize; } )(); + +export { jQuery, jQuery as $ }; diff --git a/src/selector/createCache.js b/src/selector/createCache.js index 18e255d0f..d46985fcb 100644 --- a/src/selector/createCache.js +++ b/src/selector/createCache.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; /** * Create key-value caches of limited size @@ -6,7 +6,7 @@ import jQuery from "../core.js"; * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ -function createCache() { +export function createCache() { var keys = []; function cache( key, value ) { @@ -22,5 +22,3 @@ function createCache() { } return cache; } - -export default createCache; diff --git a/src/selector/escapeSelector.js b/src/selector/escapeSelector.js index bc61355fa..18c659148 100644 --- a/src/selector/escapeSelector.js +++ b/src/selector/escapeSelector.js @@ -1,4 +1,4 @@ -import jQuery from "../core.js"; +import { jQuery } from "../core.js"; // CSS string/identifier serialization // https://drafts.csswg.org/cssom/#common-serializing-idioms diff --git a/src/selector/filterMatchExpr.js b/src/selector/filterMatchExpr.js index 17056a555..65675bd40 100644 --- a/src/selector/filterMatchExpr.js +++ b/src/selector/filterMatchExpr.js @@ -1,9 +1,9 @@ -import whitespace from "../var/whitespace.js"; -import identifier from "./var/identifier.js"; -import attributes from "./var/attributes.js"; -import pseudos from "./var/pseudos.js"; +import { whitespace } from "../var/whitespace.js"; +import { identifier } from "./var/identifier.js"; +import { attributes } from "./var/attributes.js"; +import { pseudos } from "./var/pseudos.js"; -var filterMatchExpr = { +export var filterMatchExpr = { ID: new RegExp( "^#(" + identifier + ")" ), CLASS: new RegExp( "^\\.(" + identifier + ")" ), TAG: new RegExp( "^(" + identifier + "|[*])" ), @@ -14,5 +14,3 @@ var filterMatchExpr = { whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ) }; - -export default filterMatchExpr; diff --git a/src/selector/preFilter.js b/src/selector/preFilter.js index 4a2fb489a..c6a9cdfc9 100644 --- a/src/selector/preFilter.js +++ b/src/selector/preFilter.js @@ -1,10 +1,10 @@ -import rpseudo from "./var/rpseudo.js"; -import filterMatchExpr from "./filterMatchExpr.js"; -import unescapeSelector from "./unescapeSelector.js"; -import selectorError from "./selectorError.js"; -import tokenize from "./tokenize.js"; +import { rpseudo } from "./var/rpseudo.js"; +import { filterMatchExpr } from "./filterMatchExpr.js"; +import { unescapeSelector } from "./unescapeSelector.js"; +import { selectorError } from "./selectorError.js"; +import { tokenize } from "./tokenize.js"; -var preFilter = { +export var preFilter = { ATTR: function( match ) { match[ 1 ] = unescapeSelector( match[ 1 ] ); @@ -86,5 +86,3 @@ var preFilter = { return match.slice( 0, 3 ); } }; - -export default preFilter; diff --git a/src/selector/rbuggyQSA.js b/src/selector/rbuggyQSA.js index 674598e83..7e4632c7f 100644 --- a/src/selector/rbuggyQSA.js +++ b/src/selector/rbuggyQSA.js @@ -1,8 +1,8 @@ -import isIE from "../var/isIE.js"; -import whitespace from "../var/whitespace.js"; -import support from "./support.js"; +import { isIE } from "../var/isIE.js"; +import { whitespace } from "../var/whitespace.js"; +import { support } from "./support.js"; -var rbuggyQSA = []; +export var rbuggyQSA = []; if ( isIE ) { rbuggyQSA.push( @@ -33,5 +33,3 @@ if ( !support.cssHas ) { } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - -export default rbuggyQSA; diff --git a/src/selector/selectorError.js b/src/selector/selectorError.js index a02e516da..69770ec6a 100644 --- a/src/selector/selectorError.js +++ b/src/selector/selectorError.js @@ -1,5 +1,3 @@ -function selectorError( msg ) { +export function selectorError( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); } - -export default selectorError; diff --git a/src/selector/support.js b/src/selector/support.js index 572038747..685cf3613 100644 --- a/src/selector/support.js +++ b/src/selector/support.js @@ -1,5 +1,5 @@ -import document from "../var/document.js"; -import support from "../var/support.js"; +import { document } from "../var/document.js"; +import { support } from "../var/support.js"; // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only // Make sure the `:has()` argument is parsed unforgivingly. @@ -17,4 +17,4 @@ try { support.cssHas = true; } -export default support; +export { support }; diff --git a/src/selector/testContext.js b/src/selector/testContext.js index a54351e64..cb37629f5 100644 --- a/src/selector/testContext.js +++ b/src/selector/testContext.js @@ -3,8 +3,6 @@ * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ -function testContext( context ) { +export function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } - -export default testContext; diff --git a/src/selector/toSelector.js b/src/selector/toSelector.js index bd0c15f69..71cdebc2d 100644 --- a/src/selector/toSelector.js +++ b/src/selector/toSelector.js @@ -1,4 +1,4 @@ -function toSelector( tokens ) { +export function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; @@ -7,5 +7,3 @@ function toSelector( tokens ) { } return selector; } - -export default toSelector; diff --git a/src/selector/tokenize.js b/src/selector/tokenize.js index 34bc9ad50..3c1e06c46 100644 --- a/src/selector/tokenize.js +++ b/src/selector/tokenize.js @@ -1,14 +1,14 @@ -import jQuery from "../core.js"; -import rcomma from "./var/rcomma.js"; -import rleadingCombinator from "./var/rleadingCombinator.js"; -import rtrim from "../var/rtrim.js"; -import createCache from "./createCache.js"; -import selectorError from "./selectorError.js"; -import filterMatchExpr from "./filterMatchExpr.js"; +import { jQuery } from "../core.js"; +import { rcomma } from "./var/rcomma.js"; +import { rleadingCombinator } from "./var/rleadingCombinator.js"; +import { rtrim } from "../var/rtrim.js"; +import { createCache } from "./createCache.js"; +import { selectorError } from "./selectorError.js"; +import { filterMatchExpr } from "./filterMatchExpr.js"; var tokenCache = createCache(); -function tokenize( selector, parseOnly ) { +export function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -79,5 +79,3 @@ function tokenize( selector, parseOnly ) { // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } - -export default tokenize; diff --git a/src/selector/unescapeSelector.js b/src/selector/unescapeSelector.js index 3a01f94bc..05c1d9e76 100644 --- a/src/selector/unescapeSelector.js +++ b/src/selector/unescapeSelector.js @@ -1,6 +1,6 @@ // CSS escapes // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters -import whitespace from "../var/whitespace.js"; +import { whitespace } from "../var/whitespace.js"; var runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), @@ -22,8 +22,6 @@ var runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; -function unescapeSelector( sel ) { +export function unescapeSelector( sel ) { return sel.replace( runescape, funescape ); } - -export default unescapeSelector; diff --git a/src/selector/uniqueSort.js b/src/selector/uniqueSort.js index 91c7193e9..ef3d6811d 100644 --- a/src/selector/uniqueSort.js +++ b/src/selector/uniqueSort.js @@ -1,8 +1,8 @@ -import jQuery from "../core.js"; -import document from "../var/document.js"; -import sort from "../var/sort.js"; -import splice from "../var/splice.js"; -import slice from "../var/slice.js"; +import { jQuery } from "../core.js"; +import { document } from "../var/document.js"; +import { sort } from "../var/sort.js"; +import { splice } from "../var/splice.js"; +import { slice } from "../var/slice.js"; var hasDuplicate; diff --git a/src/selector/var/attributes.js b/src/selector/var/attributes.js index f9813acec..33ba1ace2 100644 --- a/src/selector/var/attributes.js +++ b/src/selector/var/attributes.js @@ -1,8 +1,8 @@ -import whitespace from "../../var/whitespace.js"; -import identifier from "./identifier.js"; +import { whitespace } from "../../var/whitespace.js"; +import { identifier } from "./identifier.js"; // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors -export default "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + +export var attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + diff --git a/src/selector/var/booleans.js b/src/selector/var/booleans.js index 9dc3c97c7..bbdc4fdfc 100644 --- a/src/selector/var/booleans.js +++ b/src/selector/var/booleans.js @@ -1,2 +1,2 @@ -export default "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + - "loop|multiple|open|readonly|required|scoped"; +export var booleans = "checked|selected|async|autofocus|autoplay|controls|" + + "defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped"; diff --git a/src/selector/var/identifier.js b/src/selector/var/identifier.js index 03af0ddf3..d7e77ca4d 100644 --- a/src/selector/var/identifier.js +++ b/src/selector/var/identifier.js @@ -1,5 +1,5 @@ -import whitespace from "../../var/whitespace.js"; +import { whitespace } from "../../var/whitespace.js"; // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram -export default "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + +export var identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+"; diff --git a/src/selector/var/matches.js b/src/selector/var/matches.js index 6f79452a1..3d87db3df 100644 --- a/src/selector/var/matches.js +++ b/src/selector/var/matches.js @@ -1,5 +1,5 @@ -import documentElement from "../../var/documentElement.js"; +import { documentElement } from "../../var/documentElement.js"; // Support: IE 9 - 11+ // IE requires a prefix. -export default documentElement.matches || documentElement.msMatchesSelector; +export var matches = documentElement.matches || documentElement.msMatchesSelector; diff --git a/src/selector/var/pseudos.js b/src/selector/var/pseudos.js index fdf288270..64fde1d1c 100644 --- a/src/selector/var/pseudos.js +++ b/src/selector/var/pseudos.js @@ -1,7 +1,7 @@ -import identifier from "./identifier.js"; -import attributes from "./attributes.js"; +import { identifier } from "./identifier.js"; +import { attributes } from "./attributes.js"; -export default ":(" + identifier + ")(?:\\((" + +export var pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) diff --git a/src/selector/var/rcomma.js b/src/selector/var/rcomma.js index f5803f90f..acb651619 100644 --- a/src/selector/var/rcomma.js +++ b/src/selector/var/rcomma.js @@ -1,3 +1,3 @@ -import whitespace from "../../var/whitespace.js"; +import { whitespace } from "../../var/whitespace.js"; -export default new RegExp( "^" + whitespace + "*," + whitespace + "*" ); +export var rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ); diff --git a/src/selector/var/rdescend.js b/src/selector/var/rdescend.js index bab600901..6a4cd8885 100644 --- a/src/selector/var/rdescend.js +++ b/src/selector/var/rdescend.js @@ -1,3 +1,3 @@ -import whitespace from "../../var/whitespace.js"; +import { whitespace } from "../../var/whitespace.js"; -export default new RegExp( whitespace + "|>" ); +export var rdescend = new RegExp( whitespace + "|>" ); diff --git a/src/selector/var/rleadingCombinator.js b/src/selector/var/rleadingCombinator.js index f802dc8c0..c620dc914 100644 --- a/src/selector/var/rleadingCombinator.js +++ b/src/selector/var/rleadingCombinator.js @@ -1,4 +1,4 @@ -import whitespace from "../../var/whitespace.js"; +import { whitespace } from "../../var/whitespace.js"; -export default new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + - whitespace + "*" ); +export var rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + + whitespace + ")" + whitespace + "*" ); diff --git a/src/selector/var/rpseudo.js b/src/selector/var/rpseudo.js index 9ed943a5f..bcf869304 100644 --- a/src/selector/var/rpseudo.js +++ b/src/selector/var/rpseudo.js @@ -1,3 +1,3 @@ -import pseudos from "./pseudos.js"; +import { pseudos } from "./pseudos.js"; -export default new RegExp( pseudos ); +export var rpseudo = new RegExp( pseudos ); diff --git a/src/selector/var/rsibling.js b/src/selector/var/rsibling.js index 9aa815895..e80fcf91c 100644 --- a/src/selector/var/rsibling.js +++ b/src/selector/var/rsibling.js @@ -1 +1 @@ -export default /[+~]/; +export var rsibling = /[+~]/; diff --git a/src/serialize.js b/src/serialize.js index ebe733450..704fe09bc 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -1,6 +1,6 @@ -import jQuery from "./core.js"; -import toType from "./core/toType.js"; -import rcheckableType from "./var/rcheckableType.js"; +import { jQuery } from "./core.js"; +import { toType } from "./core/toType.js"; +import { rcheckableType } from "./var/rcheckableType.js"; import "./core/init.js"; import "./traversing.js"; // filter @@ -126,4 +126,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/traversing.js b/src/traversing.js index 5ce33f317..374c4b794 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -1,10 +1,10 @@ -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 { 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"; @@ -190,4 +190,4 @@ jQuery.each( { }; } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/src/traversing/findFilter.js b/src/traversing/findFilter.js index 42022180c..66fd76645 100644 --- a/src/traversing/findFilter.js +++ b/src/traversing/findFilter.js @@ -1,6 +1,6 @@ -import jQuery from "../core.js"; -import indexOf from "../var/indexOf.js"; -import rneedsContext from "./var/rneedsContext.js"; +import { jQuery } from "../core.js"; +import { indexOf } from "../var/indexOf.js"; +import { rneedsContext } from "./var/rneedsContext.js"; import "../selector.js"; diff --git a/src/traversing/var/dir.js b/src/traversing/var/dir.js index 3729d9b73..93dbf8c08 100644 --- a/src/traversing/var/dir.js +++ b/src/traversing/var/dir.js @@ -1,6 +1,6 @@ -import jQuery from "../../core.js"; +import { jQuery } from "../../core.js"; -export default function( elem, dir, until ) { +export function dir( elem, dir, until ) { var matched = [], truncate = until !== undefined; diff --git a/src/traversing/var/rneedsContext.js b/src/traversing/var/rneedsContext.js index 9038e17cd..667303f84 100644 --- a/src/traversing/var/rneedsContext.js +++ b/src/traversing/var/rneedsContext.js @@ -1,5 +1,5 @@ -import jQuery from "../../core.js"; +import { jQuery } from "../../core.js"; import "../../selector.js"; -export default jQuery.expr.match.needsContext; +export var rneedsContext = jQuery.expr.match.needsContext; diff --git a/src/traversing/var/siblings.js b/src/traversing/var/siblings.js index fe51094bd..3b908d7fd 100644 --- a/src/traversing/var/siblings.js +++ b/src/traversing/var/siblings.js @@ -1,4 +1,4 @@ -export default function( n, elem ) { +export function siblings( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { diff --git a/src/var/ObjectFunctionString.js b/src/var/ObjectFunctionString.js index c8fdcd989..89430c4a1 100644 --- a/src/var/ObjectFunctionString.js +++ b/src/var/ObjectFunctionString.js @@ -1,3 +1,3 @@ -import fnToString from "./fnToString.js"; +import { fnToString } from "./fnToString.js"; -export default fnToString.call( Object ); +export var ObjectFunctionString = fnToString.call( Object ); diff --git a/src/var/arr.js b/src/var/arr.js index d6d1738de..2b6353667 100644 --- a/src/var/arr.js +++ b/src/var/arr.js @@ -1 +1 @@ -export default []; +export var arr = []; diff --git a/src/var/class2type.js b/src/var/class2type.js index 758dff6de..7ef6b59da 100644 --- a/src/var/class2type.js +++ b/src/var/class2type.js @@ -1,2 +1,2 @@ // [[Class]] -> type pairs -export default {}; +export var class2type = {}; diff --git a/src/var/document.js b/src/var/document.js index db89b6875..8f09bef47 100644 --- a/src/var/document.js +++ b/src/var/document.js @@ -1 +1 @@ -export default window.document; +export var document = window.document; diff --git a/src/var/documentElement.js b/src/var/documentElement.js index 4bad20e54..d2fa52346 100644 --- a/src/var/documentElement.js +++ b/src/var/documentElement.js @@ -1,3 +1,3 @@ -import document from "./document.js"; +import { document } from "./document.js"; -export default document.documentElement; +export var documentElement = document.documentElement; diff --git a/src/var/flat.js b/src/var/flat.js index de911aeef..269ebec11 100644 --- a/src/var/flat.js +++ b/src/var/flat.js @@ -1,8 +1,8 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; // Support: IE 11+ // IE doesn't have Array#flat; provide a fallback. -export default arr.flat ? function( array ) { +export var flat = 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 10042138e..332dd1296 100644 --- a/src/var/fnToString.js +++ b/src/var/fnToString.js @@ -1,3 +1,3 @@ -import hasOwn from "./hasOwn.js"; +import { hasOwn } from "./hasOwn.js"; -export default hasOwn.toString; +export var fnToString = hasOwn.toString; diff --git a/src/var/getProto.js b/src/var/getProto.js index 392cd3973..519db04dc 100644 --- a/src/var/getProto.js +++ b/src/var/getProto.js @@ -1 +1 @@ -export default Object.getPrototypeOf; +export var getProto = Object.getPrototypeOf; diff --git a/src/var/hasOwn.js b/src/var/hasOwn.js index 62f2c1852..eff6b7805 100644 --- a/src/var/hasOwn.js +++ b/src/var/hasOwn.js @@ -1,3 +1,3 @@ -import class2type from "./class2type.js"; +import { class2type } from "./class2type.js"; -export default class2type.hasOwnProperty; +export var hasOwn = class2type.hasOwnProperty; diff --git a/src/var/indexOf.js b/src/var/indexOf.js index f1342c8f7..93cd31b71 100644 --- a/src/var/indexOf.js +++ b/src/var/indexOf.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.indexOf; +export var indexOf = arr.indexOf; diff --git a/src/var/isIE.js b/src/var/isIE.js index a239745ea..6a6645569 100644 --- a/src/var/isIE.js +++ b/src/var/isIE.js @@ -1,3 +1,3 @@ -import document from "./document.js"; +import { document } from "./document.js"; -export default document.documentMode; +export var isIE = document.documentMode; diff --git a/src/var/isWindow.js b/src/var/isWindow.js index 25f22dbe3..3018a379a 100644 --- a/src/var/isWindow.js +++ b/src/var/isWindow.js @@ -1,3 +1,3 @@ -export default function isWindow( obj ) { +export function isWindow( obj ) { return obj != null && obj === obj.window; } diff --git a/src/var/pnum.js b/src/var/pnum.js index 5f6bca473..d8426e577 100644 --- a/src/var/pnum.js +++ b/src/var/pnum.js @@ -1 +1 @@ -export default ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; +export var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; diff --git a/src/var/pop.js b/src/var/pop.js index b1c9131c5..4ab9514a6 100644 --- a/src/var/pop.js +++ b/src/var/pop.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.pop; +export var pop = arr.pop; diff --git a/src/var/push.js b/src/var/push.js index 2758aa587..51ba05ce7 100644 --- a/src/var/push.js +++ b/src/var/push.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.push; +export var push = arr.push; diff --git a/src/var/rcheckableType.js b/src/var/rcheckableType.js index 9fc4b55dc..19da1790f 100644 --- a/src/var/rcheckableType.js +++ b/src/var/rcheckableType.js @@ -1 +1 @@ -export default ( /^(?:checkbox|radio)$/i ); +export var rcheckableType = /^(?:checkbox|radio)$/i; diff --git a/src/var/rcssNum.js b/src/var/rcssNum.js index c96eb65ca..823636c2f 100644 --- a/src/var/rcssNum.js +++ b/src/var/rcssNum.js @@ -1,3 +1,3 @@ -import pnum from "../var/pnum.js"; +import { pnum } from "../var/pnum.js"; -export default new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); +export var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); diff --git a/src/var/rnothtmlwhite.js b/src/var/rnothtmlwhite.js index db2a9e360..ac8586dbc 100644 --- a/src/var/rnothtmlwhite.js +++ b/src/var/rnothtmlwhite.js @@ -1,4 +1,4 @@ // 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 ); +export var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; diff --git a/src/var/rtrim.js b/src/var/rtrim.js index 89d86d17a..aa20c961c 100644 --- a/src/var/rtrim.js +++ b/src/var/rtrim.js @@ -1,6 +1,6 @@ -import whitespace from "./whitespace.js"; +import { whitespace } from "./whitespace.js"; -export default new RegExp( +export var rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ); diff --git a/src/var/slice.js b/src/var/slice.js index 4d767ac98..386d342c2 100644 --- a/src/var/slice.js +++ b/src/var/slice.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.slice; +export var slice = arr.slice; diff --git a/src/var/sort.js b/src/var/sort.js index 031be7706..2752de2a6 100644 --- a/src/var/sort.js +++ b/src/var/sort.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.sort; +export var sort = arr.sort; diff --git a/src/var/splice.js b/src/var/splice.js index 7b3661cd1..253866f3a 100644 --- a/src/var/splice.js +++ b/src/var/splice.js @@ -1,3 +1,3 @@ -import arr from "./arr.js"; +import { arr } from "./arr.js"; -export default arr.splice; +export var splice = arr.splice; diff --git a/src/var/support.js b/src/var/support.js index cc0a15d15..5d114afba 100644 --- a/src/var/support.js +++ b/src/var/support.js @@ -1,2 +1,2 @@ // All support tests are defined in their respective modules. -export default {}; +export var support = {}; diff --git a/src/var/toString.js b/src/var/toString.js index 01682d601..f60fc5ec0 100644 --- a/src/var/toString.js +++ b/src/var/toString.js @@ -1,3 +1,3 @@ -import class2type from "./class2type.js"; +import { class2type } from "./class2type.js"; -export default class2type.toString; +export var toString = class2type.toString; diff --git a/src/var/whitespace.js b/src/var/whitespace.js index dcac814c7..375e76e27 100644 --- a/src/var/whitespace.js +++ b/src/var/whitespace.js @@ -1,2 +1,2 @@ // https://www.w3.org/TR/css3-selectors/#whitespace -export default "[\\x20\\t\\r\\n\\f]"; +export var whitespace = "[\\x20\\t\\r\\n\\f]"; diff --git a/src/wrap.js b/src/wrap.js index cd7636b8d..4a37002a7 100644 --- a/src/wrap.js +++ b/src/wrap.js @@ -1,4 +1,4 @@ -import jQuery from "./core.js"; +import { jQuery } from "./core.js"; import "./core/init.js"; import "./manipulation.js"; // clone @@ -70,4 +70,4 @@ jQuery.fn.extend( { } } ); -export default jQuery; +export { jQuery, jQuery as $ }; diff --git a/test/jquery.js b/test/jquery.js index 4146aec13..0340fb6e0 100644 --- a/test/jquery.js +++ b/test/jquery.js @@ -59,7 +59,7 @@ // with a SyntaxError here. dynamicImportSource = "" + "import( `${ parentUrl }src/jquery.js` )\n" + - " .then( ( { default: jQuery } ) => {\n" + + " .then( ( { jQuery } ) => {\n" + " window.jQuery = jQuery;\n" + " if ( typeof loadTests === \"function\" ) {\n" + " // Include tests if specified\n" + -- 2.39.5