From f7045b862a5b7c3de8ee2ea3da67616b38a667cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Eduardo?= Date: Sun, 6 Aug 2017 20:43:24 -0500 Subject: first commit --- lib/jquery/src/css/var/swap.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/jquery/src/css/var/swap.js (limited to 'lib/jquery/src/css/var/swap.js') diff --git a/lib/jquery/src/css/var/swap.js b/lib/jquery/src/css/var/swap.js new file mode 100644 index 0000000..1a9556b --- /dev/null +++ b/lib/jquery/src/css/var/swap.js @@ -0,0 +1,26 @@ +define( function() { + +"use strict"; + +// A method for quickly swapping in/out CSS properties to get correct calculations. +return function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + +} ); -- cgit v1.2.3