Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define([
"./css/var/cssExpand",
"./css/var/isHidden",
"./css/var/getStyles",
"./css/var/swap",
"./css/curCSS",
"./css/adjustCSS",
"./css/defaultDisplay",
Expand All @@ -16,11 +17,10 @@ define([
"./data/var/dataPriv",

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

var
// Swappable if display is none or starts with table
Expand Down Expand Up @@ -359,7 +359,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
// but it must have a current display style that would benefit
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 All @@ -385,7 +385,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
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;

});