( elem, name, extra )
| 7061 | } |
| 7062 | |
| 7063 | function getWidthOrHeight( elem, name, extra ) { |
| 7064 | |
| 7065 | // Start with offset property, which is equivalent to the border-box value |
| 7066 | var valueIsBorderBox = true, |
| 7067 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
| 7068 | styles = getStyles( elem ), |
| 7069 | isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
| 7070 | |
| 7071 | // some non-html elements return undefined for offsetWidth, so check for null/undefined |
| 7072 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
| 7073 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
| 7074 | if ( val <= 0 || val == null ) { |
| 7075 | // Fall back to computed then uncomputed css if necessary |
| 7076 | val = curCSS( elem, name, styles ); |
| 7077 | if ( val < 0 || val == null ) { |
| 7078 | val = elem.style[ name ]; |
| 7079 | } |
| 7080 | |
| 7081 | // Computed unit is not pixels. Stop here and return. |
| 7082 | if ( rnumnonpx.test(val) ) { |
| 7083 | return val; |
| 7084 | } |
| 7085 | |
| 7086 | // we need the check for style in case a browser which returns unreliable values |
| 7087 | // for getComputedStyle silently falls back to the reliable elem.style |
| 7088 | valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); |
| 7089 | |
| 7090 | // Normalize "", auto, and prepare for extra |
| 7091 | val = parseFloat( val ) || 0; |
| 7092 | } |
| 7093 | |
| 7094 | // use the active box-sizing model to add/subtract irrelevant styles |
| 7095 | return ( val + |
| 7096 | augmentWidthOrHeight( |
| 7097 | elem, |
| 7098 | name, |
| 7099 | extra || ( isBorderBox ? "border" : "content" ), |
| 7100 | valueIsBorderBox, |
| 7101 | styles |
| 7102 | ) |
| 7103 | ) + "px"; |
| 7104 | } |
| 7105 | |
| 7106 | // Try to determine the default display value of an element |
| 7107 | function css_defaultDisplay( nodeName ) { |
no test coverage detected