diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2023-09-12 02:27:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 02:27:19 +0200 |
commit | f75daab09102a4dd5107deadb55d4a169f86254a (patch) | |
tree | 71e7b9076d61d7aed7569f51c57b8651e9c16bfc /src/css | |
parent | 42e50f8c21fbfd08092ad81add4ac38982ef0841 (diff) | |
download | jquery-f75daab09102a4dd5107deadb55d4a169f86254a.tar.gz jquery-f75daab09102a4dd5107deadb55d4a169f86254a.zip |
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
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/adjustCSS.js | 10 | ||||
-rw-r--r-- | src/css/cssCamelCase.js | 6 | ||||
-rw-r--r-- | src/css/curCSS.js | 14 | ||||
-rw-r--r-- | src/css/finalPropName.js | 6 | ||||
-rw-r--r-- | src/css/hiddenVisibleSelectors.js | 2 | ||||
-rw-r--r-- | src/css/isAutoPx.js | 4 | ||||
-rw-r--r-- | src/css/showHide.js | 10 | ||||
-rw-r--r-- | src/css/support.js | 8 | ||||
-rw-r--r-- | src/css/var/cssExpand.js | 2 | ||||
-rw-r--r-- | src/css/var/getStyles.js | 2 | ||||
-rw-r--r-- | src/css/var/isHiddenWithinTree.js | 4 | ||||
-rw-r--r-- | src/css/var/rcustomProp.js | 2 | ||||
-rw-r--r-- | src/css/var/rnumnonpx.js | 4 | ||||
-rw-r--r-- | src/css/var/swap.js | 2 |
14 files changed, 32 insertions, 44 deletions
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 = {}; |