Skip to content

Commit

Permalink
CSS: Don't expose jQuery.swap
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mgol authored and timmywil committed Apr 13, 2015
1 parent 345c95a commit 02a9d9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ define([
"./css/var/rnumnonpx",
"./css/var/cssExpand",
"./css/var/isHidden",
"./css/var/swap",
"./css/curCSS",
"./css/adjustCSS",
"./css/defaultDisplay",
"./css/addGetHookIf",
"./css/support",

"./core/init",
"./css/swap",
"./core/ready",
"./selector" // contains
], function( jQuery, pnum, access, rmargin, rcssNum, rnumnonpx, cssExpand, isHidden,
curCSS, adjustCSS, defaultDisplay, addGetHookIf, support ) {
curCSS, swap, adjustCSS, defaultDisplay, addGetHookIf, support ) {

var
// BuildExclude
Expand Down Expand Up @@ -366,7 +366,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
// however, it must have a current display style that would benefit from this
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
elem.offsetWidth === 0 ?
jQuery.swap( elem, cssShow, function() {
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
}) :
getWidthOrHeight( elem, name, extra );
Expand Down Expand Up @@ -440,7 +440,7 @@ if ( !support.opacity ) {
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) {
if ( computed ) {
return jQuery.swap( elem, { "display": "inline-block" },
return swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/css/swap.js → src/css/var/swap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
define([
"../core"
], function( jQuery ) {
define(function() {

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

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

return jQuery.swap;

});

0 comments on commit 02a9d9f

Please sign in to comment.