From 02a9d9f94b623ea8664b7b39fd57feb7de6c6a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Mon, 30 Mar 2015 19:19:15 +0200 Subject: [PATCH] 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 --- src/css.js | 8 ++++---- src/css/{ => var}/swap.js | 8 ++------ 2 files changed, 6 insertions(+), 10 deletions(-) rename src/css/{ => var}/swap.js (77%) diff --git a/src/css.js b/src/css.js index 51cc297e6..83c133e4b 100644 --- a/src/css.js +++ b/src/css.js @@ -7,6 +7,7 @@ define([ "./css/var/rnumnonpx", "./css/var/cssExpand", "./css/var/isHidden", + "./css/var/swap", "./css/curCSS", "./css/adjustCSS", "./css/defaultDisplay", @@ -14,11 +15,10 @@ define([ "./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 @@ -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 ); @@ -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" ] ); } } diff --git a/src/css/swap.js b/src/css/var/swap.js similarity index 77% rename from src/css/swap.js rename to src/css/var/swap.js index ce1643531..61351f14b 100644 --- a/src/css/swap.js +++ b/src/css/var/swap.js @@ -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 = {}; @@ -23,6 +21,4 @@ jQuery.swap = function( elem, options, callback, args ) { return ret; }; -return jQuery.swap; - });