You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.6 KiB

  1. define( [
  2. "../core",
  3. "./var/rnumnonpx",
  4. "./var/rmargin",
  5. "./var/getStyles",
  6. "./support",
  7. "../selector" // Get jQuery.contains
  8. ], function( jQuery, rnumnonpx, rmargin, getStyles, support ) {
  9. function curCSS( elem, name, computed ) {
  10. var width, minWidth, maxWidth, ret,
  11. style = elem.style;
  12. computed = computed || getStyles( elem );
  13. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
  14. // Support: Opera 12.1x only
  15. // Fall back to style even without computed
  16. // computed is undefined for elems on document fragments
  17. if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
  18. ret = jQuery.style( elem, name );
  19. }
  20. // Support: IE9
  21. // getPropertyValue is only needed for .css('filter') (#12537)
  22. if ( computed ) {
  23. // A tribute to the "awesome hack by Dean Edwards"
  24. // Android Browser returns percentage for some values,
  25. // but width seems to be reliably pixels.
  26. // This is against the CSSOM draft spec:
  27. // http://dev.w3.org/csswg/cssom/#resolved-values
  28. if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  29. // Remember the original values
  30. width = style.width;
  31. minWidth = style.minWidth;
  32. maxWidth = style.maxWidth;
  33. // Put in the new values to get a computed value out
  34. style.minWidth = style.maxWidth = style.width = ret;
  35. ret = computed.width;
  36. // Revert the changed values
  37. style.width = width;
  38. style.minWidth = minWidth;
  39. style.maxWidth = maxWidth;
  40. }
  41. }
  42. return ret !== undefined ?
  43. // Support: IE9-11+
  44. // IE returns zIndex value as an integer.
  45. ret + "" :
  46. ret;
  47. }
  48. return curCSS;
  49. } );