getBoundingClientRect should use the first rect if all rects are empty

Issue #7529540 • Assigned to Bogdan B.

Details

Created
May 11, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
  • Internet Explorer
  • Safari
Standard affected
CSSOM View Module

Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Test

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4189

<!DOCTYPE html>
<div id=x>123</div>
<script>
var r = new Range();
r.setStart(x.firstChild, 1);
r.setEnd(x.firstChild, 1);
w(r.getBoundingClientRect());
</script>

Actual result:

log: object "[object ClientRect]" (6 props: top=0, right=0, bottom=0, left=0…)

Expected result:

log: object "[object ClientRect]" (6 props: top=8, right=16, bottom=26, left=16…)
(this is what I get in Chromium, but actual numbers might depend on fonts etc.)

Spec:
https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect
https://drafts.csswg.org/cssom-view/#dom-range-getboundingclientrect

Same issue for WebKit:
https://bugs.webkit.org/show_bug.cgi?id=157577

Related Chromium issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=606662#c9

Recent spec change (because of the Chromium issue above)
https://github.com/w3c/csswg-drafts/commit/0e7a5cbdea19397086e9423b508fe6f41decdcec

Attachments

0 attachments

    Comments and activity

    • This does repro, approving for triage

    • Microsoft Edge Team

      Changed Assigned To to “Travis L.”

      Changed Assigned To to “Bogdan B.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in