( elem, name, computed )
| 5798 | } |
| 5799 | |
| 5800 | function curCSS( elem, name, computed ) { |
| 5801 | var ret, |
| 5802 | isCustomProp = rcustomProp.test( name ); |
| 5803 | |
| 5804 | computed = computed || getStyles( elem ); |
| 5805 | |
| 5806 | // getPropertyValue is needed for `.css('--customProperty')` (gh-3144) |
| 5807 | if ( computed ) { |
| 5808 | |
| 5809 | // A fallback to direct property access is needed as `computed`, being |
| 5810 | // the output of `getComputedStyle`, contains camelCased keys and |
| 5811 | // `getPropertyValue` requires kebab-case ones. |
| 5812 | // |
| 5813 | // Support: IE <=9 - 11+ |
| 5814 | // IE only supports `"float"` in `getPropertyValue`; in computed styles |
| 5815 | // it's only available as `"cssFloat"`. We no longer modify properties |
| 5816 | // sent to `.css()` apart from camelCasing, so we need to check both. |
| 5817 | // Normally, this would create difference in behavior: if |
| 5818 | // `getPropertyValue` returns an empty string, the value returned |
| 5819 | // by `.css()` would be `undefined`. This is usually the case for |
| 5820 | // disconnected elements. However, in IE even disconnected elements |
| 5821 | // with no styles return `"none"` for `getPropertyValue( "float" )` |
| 5822 | ret = computed.getPropertyValue( name ) || computed[ name ]; |
| 5823 | |
| 5824 | if ( isCustomProp && ret ) { |
| 5825 | |
| 5826 | // Support: Firefox 105 - 135+ |
| 5827 | // Spec requires trimming whitespace for custom properties (gh-4926). |
| 5828 | // Firefox only trims leading whitespace. |
| 5829 | // |
| 5830 | // Fall back to `undefined` if empty string returned. |
| 5831 | // This collapses a missing definition with property defined |
| 5832 | // and set to an empty string but there's no standard API |
| 5833 | // allowing us to differentiate them without a performance penalty |
| 5834 | // and returning `undefined` aligns with older jQuery. |
| 5835 | // |
| 5836 | // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED |
| 5837 | // as whitespace while CSS does not, but this is not a problem |
| 5838 | // because CSS preprocessing replaces them with U+000A LINE FEED |
| 5839 | // (which *is* CSS whitespace) |
| 5840 | // https://www.w3.org/TR/css-syntax-3/#input-preprocessing |
| 5841 | ret = ret.replace( rtrimCSS, "$1" ) || undefined; |
| 5842 | } |
| 5843 | |
| 5844 | if ( ret === "" && !isAttached( elem ) ) { |
| 5845 | ret = jQuery.style( elem, name ); |
| 5846 | } |
| 5847 | } |
| 5848 | |
| 5849 | return ret !== undefined ? |
| 5850 | |
| 5851 | // Support: IE <=9 - 11+ |
| 5852 | // IE returns zIndex value as an integer. |
| 5853 | ret + "" : |
| 5854 | ret; |
| 5855 | } |
| 5856 | |
| 5857 | var cssPrefixes = [ "Webkit", "Moz", "ms" ], |
no test coverage detected