Bug 138949

Summary: range.getBoundingClientRect() returns incorrect value for collapsed ranges
Product: WebKit Reporter: Glen Huang <hey.hgl>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, enrica, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Glen Huang 2014-11-20 20:51:33 PST
Example URL:
http://jsbin.com/lesobugupi/2/edit?html,js,output

Steps to reproduce the problem:
1. click on the hello text
2. see a 0 0 0 0 value in the output div

What went wrong?
range.getBoundingClientRect() should return a rect that denotes the range position even if it's collapsed, according to the spec http://www.w3.org/TR/cssom-view/#dom-range-getclientrects

Especially the "including when the boundary-points are identical" part.

Blink also has this problem. Works in gecko.
Comment 1 Glen Huang 2014-12-20 02:49:54 PST
Blink has confirmed this bug.
https://code.google.com/p/chromium/issues/detail?id=435438

I believe this bug exists pre-fork.
Comment 2 Ahmad Saleem 2022-09-17 03:48:06 PDT
I am not able to reproduce this with Safari Technology Preview 153 and it does not show "0 0 0 0" value.

I will tag others to confirm whether it is fixed it or not. Thanks!
Comment 3 Alexey Proskuryakov 2022-09-18 17:04:42 PDT

*** This bug has been marked as a duplicate of bug 196380 ***