MCPcopy Create free account
hub / github.com/frank-lam/fullstack-tutorial / curCSS

Function curCSS

notes/docsify/unpkg/gotop/jquery-2.1.0.js:5476–5521  ·  view source on GitHub ↗
( elem, name, computed )

Source from the content-addressed store, hash-verified

5474
5475
5476function curCSS( elem, name, computed ) {
5477 var width, minWidth, maxWidth, ret,
5478 style = elem.style;
5479
5480 computed = computed || getStyles( elem );
5481
5482 // Support: IE9
5483 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
5484 if ( computed ) {
5485 ret = computed.getPropertyValue( name ) || computed[ name ];
5486 }
5487
5488 if ( computed ) {
5489
5490 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
5491 ret = jQuery.style( elem, name );
5492 }
5493
5494 // Support: iOS < 6
5495 // A tribute to the "awesome hack by Dean Edwards"
5496 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
5497 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
5498 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
5499
5500 // Remember the original values
5501 width = style.width;
5502 minWidth = style.minWidth;
5503 maxWidth = style.maxWidth;
5504
5505 // Put in the new values to get a computed value out
5506 style.minWidth = style.maxWidth = style.width = ret;
5507 ret = computed.width;
5508
5509 // Revert the changed values
5510 style.width = width;
5511 style.minWidth = minWidth;
5512 style.maxWidth = maxWidth;
5513 }
5514 }
5515
5516 return ret !== undefined ?
5517 // Support: IE
5518 // IE returns zIndex value as an integer.
5519 ret + "" :
5520 ret;
5521}
5522
5523
5524function addGetHookIf( conditionFn, hookFn ) {

Callers 2

getWidthOrHeightFunction · 0.85
jquery-2.1.0.jsFile · 0.85

Calls 1

getStylesFunction · 0.85

Tested by

no test coverage detected