New issue
Advanced search Search tips

Issue 764841 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

getClientRects returns empty result if the range selects only collapsed whitespaces

Project Member Reported by xiaoche...@chromium.org, Sep 13 2017

Issue description

Chrome Version: M63 ToT

What steps will reproduce the problem?
(1) Create a document with HTML "<div>foo     bar</div>"
(2) Create a range selecting offset range [5, 6] on the text node
(3) Call getClientRects() on the range

What is the expected result?

getClientRects() returns a "caret" before "bar"

What happens instead?

getClientRects() returned an empty list


The spec (*) is pretty vague on what rects should be returned from a text node. However, we should at least ensure that the result matches
selection painting.

(*) https://drafts.csswg.org/cssom-view/#dom-range-getclientrects
 
Test case available at https://jsfiddle.net/hfabktuL/
Owner: ----
Status: Available (was: Assigned)
Not going to work on it shortly.

Comment 3 by yosin@chromium.org, Jan 10 2018

Labels: Pri-3
I have another test case at http://jsbin.com/nupinokisu/1/edit?html,js,output
See Case 5. Note that if only 3 spaces are between "a" and "b", all the collapsed positions next to or between spaces will produce a non-empty rect list. Only with at least 4 spaces does the bug appear.

Also note Case 4: when selecting between the first two spaces after "a": while getClientRects() does returns a non-empty list, the width of the first rect is non-zero, which is questionable.

Sign in to add a comment