offsetWidth of elements containing nested in block level elements reported as 0
https://bugs.webkit.org/show_bug.cgi?id=28810
Summary offsetWidth of elements containing nested in block level elements reported as 0
Daniel Wagner-Hall
Reported 2009-08-28 07:39:37 PDT
Created attachment 38734 [details] Page showing bug The offsetWidth of elements containing block-level elements is incorrectly reported as 0, rather than the maximum offsetWidth of any of its sub-elements. Note that IE and Firefox return different values for offsetWidth due to bounding box differences, but both behave as above for the nested case.
Attachments
Page showing bug (601 bytes, text/html)
2009-08-28 07:39 PDT, Daniel Wagner-Hall
no flags
Carl Hempel
Comment 1 2010-02-03 05:44:50 PST
I'm also experiencing this bug
Marek Stepien
Comment 2 2010-06-17 03:56:31 PDT
I can also see this bug in Safari 5 and recent Chrome 6 dev builds.
Greg Dennis
Comment 3 2010-08-24 12:41:29 PDT
I see this in Chrome 5 and Chrome 6 beta.
Niall Smart
Comment 4 2011-05-22 10:54:31 PDT
Reproduced in Chrome 11.0.696.68
paynalton
Comment 5 2011-10-17 12:21:01 PDT
Confirmed on Chromium 14.0.835.163 and Safari 5.0 (7533.16). Problem extended to multiple IMG elements into a div and another div with css IMG: width:auto; height:100%; Containerdiv: width:noSet; height:noSet; ContainerContainerDiv: width:300px; height:300px; Structure: Div class ContainerContainerDiv Div class ContainerDiv IMG IMG IMG javascript: alert(IMG_DOM_ELEMENT.offsetWidth) //Result: 0
Ahmad Saleem
Comment 6 2022-07-27 13:29:49 PDT
I am able to reproduce this bug using attached test case in Safari 15.6 on macOS 12.5 and it shows "test2.offsetWidth: 0" - which is what this bug about. Here are results from other browsers: ** Firefox Nightly 105 ** test1.offsetWidth: 96 test2.offsetWidth: 1277 ** Chrome Canary 106 ** test1.offsetWidth: 96 test2.offsetWidth: 1287 (There was another bug where Chrome was different from Firefox with just 10 px and it was about scrollbar - just want to add some note here) ** Safari 15.6 on macOS 12.5 ** test1.offsetWidth: 96 test2.offsetWidth: 0 Just find updated results. Thanks!
Radar WebKit Bug Importer
Comment 7 2022-07-27 17:53:48 PDT
Note You need to log in before you can comment on or make changes to this bug.