MCPcopy Index your code
hub / github.com/jquery/jquery / curCSS

Function curCSS

dist-module/jquery.slim.module.js:5467–5522  ·  view source on GitHub ↗
( elem, name, computed )

Source from the content-addressed store, hash-verified

5465}
5466
5467function curCSS( elem, name, computed ) {
5468 var ret,
5469 isCustomProp = rcustomProp.test( name );
5470
5471 computed = computed || getStyles( elem );
5472
5473 // getPropertyValue is needed for `.css('--customProperty')` (gh-3144)
5474 if ( computed ) {
5475
5476 // A fallback to direct property access is needed as `computed`, being
5477 // the output of `getComputedStyle`, contains camelCased keys and
5478 // `getPropertyValue` requires kebab-case ones.
5479 //
5480 // Support: IE <=9 - 11+
5481 // IE only supports `"float"` in `getPropertyValue`; in computed styles
5482 // it's only available as `"cssFloat"`. We no longer modify properties
5483 // sent to `.css()` apart from camelCasing, so we need to check both.
5484 // Normally, this would create difference in behavior: if
5485 // `getPropertyValue` returns an empty string, the value returned
5486 // by `.css()` would be `undefined`. This is usually the case for
5487 // disconnected elements. However, in IE even disconnected elements
5488 // with no styles return `"none"` for `getPropertyValue( "float" )`
5489 ret = computed.getPropertyValue( name ) || computed[ name ];
5490
5491 if ( isCustomProp && ret ) {
5492
5493 // Support: Firefox 105 - 135+
5494 // Spec requires trimming whitespace for custom properties (gh-4926).
5495 // Firefox only trims leading whitespace.
5496 //
5497 // Fall back to `undefined` if empty string returned.
5498 // This collapses a missing definition with property defined
5499 // and set to an empty string but there's no standard API
5500 // allowing us to differentiate them without a performance penalty
5501 // and returning `undefined` aligns with older jQuery.
5502 //
5503 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
5504 // as whitespace while CSS does not, but this is not a problem
5505 // because CSS preprocessing replaces them with U+000A LINE FEED
5506 // (which *is* CSS whitespace)
5507 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
5508 ret = ret.replace( rtrimCSS, "$1" ) || undefined;
5509 }
5510
5511 if ( ret === "" && !isAttached( elem ) ) {
5512 ret = jQuery.style( elem, name );
5513 }
5514 }
5515
5516 return ret !== undefined ?
5517
5518 // Support: IE <=9 - 11+
5519 // IE returns zIndex value as an integer.
5520 ret + "" :
5521 ret;
5522}
5523
5524function adjustCSS( elem, prop, valueParts, tween ) {

Callers 2

getWidthOrHeightFunction · 0.70
jQueryFactoryFunction · 0.70

Calls 2

getStylesFunction · 0.70
isAttachedFunction · 0.70

Tested by

no test coverage detected