getBoundingClientRect returns incorrect values with a button containing an icon
Reported by
lingta...@gmail.com,
Oct 4 2016
|
||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0 Steps to reproduce the problem: I have a page with a "button" tag containing an "i" tag. When I measure the width of the button (by taking a screenshot) I get a width of 144px, but if I use the getBoundingClientRect method in chrome 53/55, it returns 194.625px. The experiment above is described with greater details here: https://github.com/lingtalfi/browsers-behaviours/blob/master/get-bounding-client-rect/bcr-icon.md What is the expected behavior? I expected that getBoundingClientRect's method would return an object with the actual/accurate width of the button on the screen. What went wrong? It seems to add 50px, I'm not sure why. Did this work before? N/A Chrome version: 53 Channel: n/a OS Version: OS X 10.11 Flash Version: Shockwave Flash 23.0 r0
,
Oct 10 2016
Issue 654260 has been merged into this issue.
,
Oct 10 2016
If you remove the Google fonts <link rel> tag, you get the larger result, since the box spells "favorite" instead of the heart icon. I'd suggest to fix the font load race condition in the bug, by using document.fonts.ready for example. Once the font is loaded, as in the http://codepen.io/lingtalfi/pen/dpmOPp issue, when touching any of the HTML and rerunning it in codepen, you will get the expected result of 144px. I don't see any issue in Chrome here. Please reopen if you have a new test case or still believe there is a bug.
,
Oct 11 2016
Oh, thanks. I was unaware of the browsers downloading font problem. That's indeed the problem. |
||
►
Sign in to add a comment |
||
Comment 1 by cbiesin...@chromium.org
, Oct 4 2016