Sha256: 5334dcca2c5131b4a28cd6dedb36b52a73c5923fc1d05e8ed098793046485efd

Contents?: true

Size: 1.82 KB

Versions: 558

Compression:

Stored size: 1.82 KB

Contents

define( [
	"../core",
	"../var/rcssNum"
], function( jQuery, rcssNum ) {

function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted,
		scale = 1,
		maxIterations = 20,
		currentValue = tween ?
			function() { return tween.cur(); } :
			function() { return jQuery.css( elem, prop, "" ); },
		initial = currentValue(),
		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),

		// Starting value computation is required for potential unit mismatches
		initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

		// Trust units reported by jQuery.css
		unit = unit || initialInUnit[ 3 ];

		// Make sure we update the tween properties later on
		valueParts = valueParts || [];

		// Iteratively approximate from a nonzero starting point
		initialInUnit = +initial || 1;

		do {

			// If previous iteration zeroed out, double until we get *something*.
			// Use string for doubling so we don't accidentally see scale as unchanged below
			scale = scale || ".5";

			// Adjust and apply
			initialInUnit = initialInUnit / scale;
			jQuery.style( elem, prop, initialInUnit + unit );

		// Update scale, tolerating zero or NaN from tween.cur()
		// Break the loop if scale is unchanged or perfect, or if we've just had enough.
		} while (
			scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
		);
	}

	if ( valueParts ) {
		initialInUnit = +initialInUnit || +initial || 0;

		// Apply relative offset (+=/-=) if specified
		adjusted = valueParts[ 1 ] ?
			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
			+valueParts[ 2 ];
		if ( tween ) {
			tween.unit = unit;
			tween.start = initialInUnit;
			tween.end = adjusted;
		}
	}
	return adjusted;
}

return adjustCSS;
} );

Version data entries

558 entries across 501 versions & 12 rubygems

Version Path
epuber-0.10.3 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.10.2 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.10.1 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.9.3 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.9.2 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.9.1 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.9.0 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.8.0 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.7.4 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.7.3 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.7.2 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.7.1 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
epuber-0.7.0 lib/epuber/third_party/bower/bower_components/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.9.2 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.9.1 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.9.0 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.8.1 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.8.0 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.7.1 node_modules/jquery/src/css/adjustCSS.js
govuk_publishing_components-28.6.0 node_modules/jquery/src/css/adjustCSS.js