Sha256: d633b3d787f3f661fc0dd0654ef44516f6e91ae99ef13c3797a716d9a9aee362

Contents?: true

Size: 1.96 KB

Versions: 41

Compression:

Stored size: 1.96 KB

Contents

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

"use strict";

function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted, scale,
		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 = elem.nodeType &&
			( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

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

		// Support: Firefox <=54
		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
		initial = initial / 2;

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

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

		while ( maxIterations-- ) {

			// Evaluate and update our best guess (doubling guesses that zero out).
			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
			jQuery.style( elem, prop, initialInUnit + unit );
			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
				maxIterations = 0;
			}
			initialInUnit = initialInUnit / scale;

		}

		initialInUnit = initialInUnit * 2;
		jQuery.style( elem, prop, initialInUnit + unit );

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

	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

41 entries across 32 versions & 6 rubygems

Version Path
trusty-cms-6.3.1 node_modules/jquery-treetable/node_modules/jquery/src/css/adjustCSS.js
trusty-cms-6.3.1 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-6.3.1 node_modules/jquery-ujs/node_modules/jquery/src/css/adjustCSS.js
optimacms-0.1.61 spec/dummy/node_modules/cocoon-js/node_modules/jquery/src/css/adjustCSS.js
optimacms-0.1.61 spec/dummy/node_modules/jquery-ujs/node_modules/jquery/src/css/adjustCSS.js
udt-itf-theme-0.1.0 _sass/node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.7 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.6 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.5 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.4 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.3 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.2 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.1 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.5 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-5.0.0 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.4 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.4 spec/dummy/node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.3 spec/dummy/node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.3 node_modules/jquery/src/css/adjustCSS.js
trusty-cms-4.3.2 spec/dummy/node_modules/jquery/src/css/adjustCSS.js