diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-08-25 11:26:37 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-08-28 08:56:06 -0400 |
commit | c078b83b3fea891e0c228a9f2d101481678b4c9d (patch) | |
tree | 90e888b68711064d984c5d11e57a4481c3f66d08 | |
parent | 9a92c5423fed1cbe81eb2516dd41cb1f4c2930a5 (diff) | |
download | jquery-c078b83b3fea891e0c228a9f2d101481678b4c9d.tar.gz jquery-c078b83b3fea891e0c228a9f2d101481678b4c9d.zip |
Fix #12313, .height()/.width() just use CSS if no offsetWidth. Close gh-909.
-rw-r--r-- | src/css.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/css.js b/src/css.js index 3d7565020..5144ee9ca 100644 --- a/src/css.js +++ b/src/css.js @@ -411,7 +411,10 @@ function getWidthOrHeight( elem, name, extra ) { valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; - if ( val <= 0 ) { + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name ); if ( val < 0 || val == null ) { |