A range with collapsed selection in an empty element returns an empty array from getClientRects() and a bounding rectangle with zeroed properties
Reported by
ishi...@gmail.com,
Apr 6 2018
|
|
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: See linked JsFiddle which illustrates the issue: https://jsfiddle.net/hozkkjqq/27/ 1. Place cursor into an empty content editable element with no text. 2. Get window seletion. 3. Get range at index 0. 4. Call range's bounding client rectangle. What is the expected behavior? As I read the spec, this return the client rectangles of the containing element since the selection is collapsed and the start and end containers are not text nodes. https://drafts.csswg.org/cssom-view/#dom-range-getclientrects In particular: "For each element selected by the range, whose parent is not selected by the range, include the border areas returned by invoking getClientRects() on the element." What went wrong? It returns an DOMRect with all properties set to 0 (x, y, width, height, top, left, right, bottom). This feels wrong since this range is in the DOM, is rendered and should have an x & y coordinate along with top, left, right, bottom. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 65.0.3325.181 Channel: stable OS Version: OS X 10.13.4 Flash Version: This isn't exactly helpful but I believe this used to return either null or what I believe is the expected behavior. Something changed around Chrome 63. Seems to be related to this bug as well: https://bugs.chromium.org/p/chromium/issues/detail?id=637296
,
Apr 6 2018
Thanks, I'll try moving the conversation there by filing an issue on the spec.
,
Apr 6 2018
For reference: https://github.com/w3c/csswg-drafts/issues/2514 |
|
►
Sign in to add a comment |
|
Comment 1 by xiaoche...@chromium.org
, Apr 6 2018Status: Available (was: Unconfirmed)