Blame view

bower_components/jquery/src/css/swap.js 555 Bytes
c5169e0e   Renato De Donato   a new hope
1
2
3
  define([
  	"../core"
  ], function( jQuery ) {
74249687   Luigi Serra   Cross browser con...
4
5
  
  // A method for quickly swapping in/out CSS properties to get correct calculations.
c5169e0e   Renato De Donato   a new hope
6
  jQuery.swap = function( elem, options, callback, args ) {
74249687   Luigi Serra   Cross browser con...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  	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;
  };
  
c5169e0e   Renato De Donato   a new hope
26
27
28
  return jQuery.swap;
  
  });