]> source.dussan.org Git - jquery.git/commitdiff
Fix #12313, .height()/.width() just use CSS if no offsetWidth. Close gh-909.
authorMike Sherov <mike.sherov@gmail.com>
Sat, 25 Aug 2012 15:26:37 +0000 (11:26 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Tue, 28 Aug 2012 12:56:06 +0000 (08:56 -0400)
src/css.js

index 3d756502038f4548f05d70c94e124b7a1dc6d399..5144ee9cadd4019612d819f1e1caa3bae285b36a 100644 (file)
@@ -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 ) {