(elem, name, computed)
| 6555 | })(); |
| 6556 | |
| 6557 | function curCSS(elem, name, computed) { |
| 6558 | var width, |
| 6559 | minWidth, |
| 6560 | maxWidth, |
| 6561 | ret, |
| 6562 | isCustomProp = rcustomProp.test(name), |
| 6563 | // Support: Firefox 51+ |
| 6564 | // Retrieving style before computed somehow |
| 6565 | // fixes an issue with getting wrong values |
| 6566 | // on detached elements |
| 6567 | style = elem.style; |
| 6568 | |
| 6569 | computed = computed || getStyles(elem); |
| 6570 | |
| 6571 | // getPropertyValue is needed for: |
| 6572 | // .css('filter') (IE 9 only, trac-12537) |
| 6573 | // .css('--customProperty) (gh-3144) |
| 6574 | if (computed) { |
| 6575 | // Support: IE <=9 - 11+ |
| 6576 | // IE only supports `"float"` in `getPropertyValue`; in computed styles |
| 6577 | // it's only available as `"cssFloat"`. We no longer modify properties |
| 6578 | // sent to `.css()` apart from camelCasing, so we need to check both. |
| 6579 | // Normally, this would create difference in behavior: if |
| 6580 | // `getPropertyValue` returns an empty string, the value returned |
| 6581 | // by `.css()` would be `undefined`. This is usually the case for |
| 6582 | // disconnected elements. However, in IE even disconnected elements |
| 6583 | // with no styles return `"none"` for `getPropertyValue( "float" )` |
| 6584 | ret = computed.getPropertyValue(name) || computed[name]; |
| 6585 | |
| 6586 | if (isCustomProp && ret) { |
| 6587 | // Support: Firefox 105+, Chrome <=105+ |
| 6588 | // Spec requires trimming whitespace for custom properties (gh-4926). |
| 6589 | // Firefox only trims leading whitespace. Chrome just collapses |
| 6590 | // both leading & trailing whitespace to a single space. |
| 6591 | // |
| 6592 | // Fall back to `undefined` if empty string returned. |
| 6593 | // This collapses a missing definition with property defined |
| 6594 | // and set to an empty string but there's no standard API |
| 6595 | // allowing us to differentiate them without a performance penalty |
| 6596 | // and returning `undefined` aligns with older jQuery. |
| 6597 | // |
| 6598 | // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED |
| 6599 | // as whitespace while CSS does not, but this is not a problem |
| 6600 | // because CSS preprocessing replaces them with U+000A LINE FEED |
| 6601 | // (which *is* CSS whitespace) |
| 6602 | // https://www.w3.org/TR/css-syntax-3/#input-preprocessing |
| 6603 | ret = ret.replace(rtrimCSS, '$1') || undefined; |
| 6604 | } |
| 6605 | |
| 6606 | if (ret === '' && !isAttached(elem)) { |
| 6607 | ret = jQuery.style(elem, name); |
| 6608 | } |
| 6609 | |
| 6610 | // A tribute to the "awesome hack by Dean Edwards" |
| 6611 | // Android Browser returns percentage for some values, |
| 6612 | // but width seems to be reliably pixels. |
| 6613 | // This is against the CSSOM draft spec: |
| 6614 | // https://drafts.csswg.org/cssom/#resolved-values |
no test coverage detected