New issue
Advanced search Search tips

Issue 765760 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 529734
Owner: ----
Closed: Sep 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

getBoundingClientRect incorrectly returns 0 for inner <svg> element

Project Member Reported by dholb...@gmail.com, Sep 15 2017

Issue description

Chrome Version: 62.0.3202.18 (Official Build) dev (64-bit)
OS: Ubuntu 17.10 beta

What steps will reproduce the problem?
(1) Visit https://jsfiddle.net/201qvyw8/

What is the expected result?
alert() should appear which shows "TEST PASSED" -- in particular, both tested <svg> element should return a 123px-wide rect from getBoundingClientRect.

What happens instead?
alert() shows "TEST FAILED", because the inner SVG element returned a 0px-wide rect from getBoundingClientRect.

Please use labels and text to provide additional information.
Spec references:
 - getBoundingClientRect is defined here (in terms of "getClientRects"), and it's supposed to include the element's "SVG layout box":
https://www.w3.org/TR/cssom-view-1/#dom-element-getclientrects

Inner SVG elements do absolutely have their own "layout box", which you can demonstrate visually if you e.g. give them an explicit width, height, and viewBox attribute (which will then prompt their own children to fit the viewBox's particular region of "SVG fragment space" into their layout box).  So I don't see any spec support for Chrome's behavior here.
 

Comment 1 by f...@opera.com, Sep 15 2017

Status: Available (was: Untriaged)
I guess this is essentially issue 529734.

If I wanted to play the spec-interpretation card, I guess I would say that the term "SVG layout box" from CSSOM View is not well defined... =)
I agree fully with the sentiment here though. (I would welcome additional input in the spec issue referenced in the issue mentioned above though.)
Mergedinto: 529734
Status: Duplicate (was: Available)

Sign in to add a comment