Skip to content

Commit 3fdd2dd

Browse files
mgolmarkelog
authored andcommitted
CSS: Don't expose jQuery.swap
jQuery.swap was an undocumented API used only internally. With the modular AMD system we currently have it's not necessary to expose this function publicly under the jQuery object. Fixes gh-2058 Closes gh-2182
1 parent 24b376c commit 3fdd2dd

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/css.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ define([
88
"./css/var/cssExpand",
99
"./css/var/isHidden",
1010
"./css/var/getStyles",
11+
"./css/var/swap",
1112
"./css/curCSS",
1213
"./css/adjustCSS",
1314
"./css/defaultDisplay",
@@ -16,11 +17,10 @@ define([
1617
"./data/var/dataPriv",
1718

1819
"./core/init",
19-
"./css/swap",
2020
"./core/ready",
2121
"./selector" // contains
2222
], function( jQuery, pnum, access, rmargin, rcssNum, rnumnonpx, cssExpand, isHidden,
23-
getStyles, curCSS, adjustCSS, defaultDisplay, addGetHookIf, support, dataPriv ) {
23+
getStyles, swap, curCSS, adjustCSS, defaultDisplay, addGetHookIf, support, dataPriv ) {
2424

2525
var
2626
// Swappable if display is none or starts with table
@@ -359,7 +359,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
359359
// but it must have a current display style that would benefit
360360
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
361361
elem.offsetWidth === 0 ?
362-
jQuery.swap( elem, cssShow, function() {
362+
swap( elem, cssShow, function() {
363363
return getWidthOrHeight( elem, name, extra );
364364
}) :
365365
getWidthOrHeight( elem, name, extra );
@@ -385,7 +385,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
385385
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
386386
function( elem, computed ) {
387387
if ( computed ) {
388-
return jQuery.swap( elem, { "display": "inline-block" },
388+
return swap( elem, { "display": "inline-block" },
389389
curCSS, [ elem, "marginRight" ] );
390390
}
391391
}

src/css/swap.js renamed to src/css/var/swap.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
define([
2-
"../core"
3-
], function( jQuery ) {
1+
define(function() {
42

53
// A method for quickly swapping in/out CSS properties to get correct calculations.
6-
jQuery.swap = function( elem, options, callback, args ) {
4+
return function swap( elem, options, callback, args ) {
75
var ret, name,
86
old = {};
97

@@ -23,6 +21,4 @@ jQuery.swap = function( elem, options, callback, args ) {
2321
return ret;
2422
};
2523

26-
return jQuery.swap;
27-
2824
});

0 commit comments

Comments
 (0)