[csswg-drafts] [cssom-view] Range.getClientRects is inconsistent (#12331)

edg2s has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Range.getClientRects is inconsistent ==
Originally reported as an issue with vendors ([Chromium bug](https://issues.chromium.org/issues/40730739?pli=1), [Bugzilla](https://bugzilla.mozilla.org/show_bug.cgi?id=1676467)):

> Steps to reproduce:
> 
> 1. Visit https://edg2s.github.io/rangefix/
> 2. Click the "Firefox triple click bug" button or triple click the paragraph which contains the inline image.
> 
> Actual results:
> 
> The rectangle for the <u> tag does not include the full height of the image tag.
> 
> Expected results:
> 
> The computed rectangles are correct.

 a Mozilla contributor suggested this is in fact an issue with the spec

> Ah, this is about `Range.getClientRects`, not about `Element.getClientRects`, sorry...
> 
> So spec is in https://drafts.csswg.org/cssom-view-1/#dom-range-getclientrects:
> 
> > 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.
> 
> So it seems to me that if `<u>` is selected by the range completely, then we'd return an smaller rect than if it wasn't per the above definition (because when `<u>` is not fully selected, then we union the `getClientRects()` of the text and the image, instead of just returning the rects of the `<u>`). That seems unfortunate, though it's what the spec seems to call for.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12331 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 12 June 2025 16:43:46 UTC