MCPcopy Create free account
hub / github.com/JsAaron/jQuery / curCSS

Function curCSS

2.1.1/test/jquery-2.1.1.js:5521–5566  ·  view source on GitHub ↗
( elem, name, computed )

Source from the content-addressed store, hash-verified

5519
5520
5521function curCSS( elem, name, computed ) {
5522 var width, minWidth, maxWidth, ret,
5523 style = elem.style;
5524
5525 computed = computed || getStyles( elem );
5526
5527 // Support: IE9
5528 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
5529 if ( computed ) {
5530 ret = computed.getPropertyValue( name ) || computed[ name ];
5531 }
5532
5533 if ( computed ) {
5534
5535 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
5536 ret = jQuery.style( elem, name );
5537 }
5538
5539 // Support: iOS < 6
5540 // A tribute to the "awesome hack by Dean Edwards"
5541 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
5542 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
5543 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
5544
5545 // Remember the original values
5546 width = style.width;
5547 minWidth = style.minWidth;
5548 maxWidth = style.maxWidth;
5549
5550 // Put in the new values to get a computed value out
5551 style.minWidth = style.maxWidth = style.width = ret;
5552 ret = computed.width;
5553
5554 // Revert the changed values
5555 style.width = width;
5556 style.minWidth = minWidth;
5557 style.maxWidth = maxWidth;
5558 }
5559 }
5560
5561 return ret !== undefined ?
5562 // Support: IE
5563 // IE returns zIndex value as an integer.
5564 ret + "" :
5565 ret;
5566}
5567
5568
5569function addGetHookIf( conditionFn, hookFn ) {

Callers 2

getWidthOrHeightFunction · 0.70
jquery-2.1.1.jsFile · 0.70

Calls 1

getStylesFunction · 0.70

Tested by

no test coverage detected