Skip to content

Commit c078b83

Browse files
mikesherovdmethvin
authored andcommitted
Fix #12313, .height()/.width() just use CSS if no offsetWidth. Close jquerygh-909.
1 parent 9a92c54 commit c078b83

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/css.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ function getWidthOrHeight( elem, name, extra ) {
411411
valueIsBorderBox = true,
412412
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
413413

414-
if ( val <= 0 ) {
414+
// some non-html elements return undefined for offsetWidth, so check for null/undefined
415+
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
416+
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
417+
if ( val <= 0 || val == null ) {
415418
// Fall back to computed then uncomputed css if necessary
416419
val = curCSS( elem, name );
417420
if ( val < 0 || val == null ) {

0 commit comments

Comments
 (0)