jquery: Regression: width() & height() return 0 for all inline elements
Description
Select any element on the page that doesn’t have an explicit width set via a stylesheet or inline attribute and call .width()
.
In jQuery 1.x, 3.0.x and 3.1.1 this returns the computed width.
As of jQuery 3.2.0 it returns 0
. This is breaking various downstream test suites for Wikimedia and is blocking our upgrade for now.
Link to test case
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 17 (11 by maintainers)
Commits related to this issue
- Dimensions: fall back to offsetWidth/Height for inline elems - Also added some more general dims tests for inline elements for posterity Fixes gh-3571 — committed to timmywil/jquery by timmywil 7 years ago
- Dimensions: fall back to offsetWidth/Height for inline elems - Also added some more general dims tests for inline elements for posterity Fixes gh-3571 — committed to timmywil/jquery by timmywil 7 years ago
- Dimensions: fall back to offsetWidth/Height for inline elems - Also added some more general dims tests for inline elements for posterity Fixes gh-3571 — committed to timmywil/jquery by timmywil 7 years ago
- Dimensions: fall back to offsetWidth/Height for inline elems Close gh-3577 Fixes gh-3571 — committed to timmywil/jquery by timmywil 7 years ago
- Dimensions: fall back to offsetWidth/Height for inline elems Close gh-3577 Fixes gh-3571 — committed to timmywil/jquery by timmywil 7 years ago
- Updated jQuery references to version 3.2.1 Important note: jQuery version 3.2.0 had a bug where the value returned by `.width()` and `.height()` was always zero for inline elements. This leads to unu... — committed to stevenbenner/jquery-powertip by stevenbenner 7 years ago
- $().height() -> $().css('height') See https://jquery.com/upgrade-guide/3.0/#breaking-change-width-height-css-quot-width-quot-and-css-quot-height-quot-can-return-non-integer-values and https://github.... — committed to WikiWatershed/model-my-watershed by rajadain 6 years ago
- $().height() -> $().css('height') See https://jquery.com/upgrade-guide/3.0/#breaking-change-width-height-css-quot-width-quot-and-css-quot-height-quot-can-return-non-integer-values and https://github.... — committed to WikiWatershed/model-my-watershed by rajadain 6 years ago
- $().height() -> $().css('height') See https://jquery.com/upgrade-guide/3.0/#breaking-change-width-height-css-quot-width-quot-and-css-quot-height-quot-can-return-non-integer-values and https://github.... — committed to WikiWatershed/model-my-watershed by rajadain 6 years ago
@mohithg The fixed version is available now: https://blog.jquery.com/2017/03/20/jquery-3-2-1-now-available/