w3c / w3c/csswg-drafts

[cssom-view] Range.getClientRects does not seem interoperable

Open
#7,155 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cssom-view-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Firefox seems to understand the specs of Range.getClientRects() differently than WebKit and Blink based browsers.
The former will apparently return only the DOMRects of the nodes appearing at the first level of the Range's content, while the latter will traverse whatever element the Range contains to find every text node.

I can understand both readings of the specs, the first step indeed asks that only the elements whose parents aren't selected in the Range participate in the DOMRectList. It can make sense that the inner text nodes would also get ignored in the second step. Also, I personally have no idea which behavior is "the best". So maybe this should be clarified here and then bugs opened on whichever implementation has to change.

I couldn't find a WPT test for this, but Chromium has a web-test that Firefox fails:
Screenshot of the getClientRects test ran on Firefox where "expected" and "actual" results differ in that "actual" doesn't render as many rects

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSSOM View specification section for Range.getClientRects() and compare its algorithm with Chromium's web-test at third_party/blink/web_tests/fast/dom/Range/getClientRects.html. Determine which interpretation is intended, clarify the specification, and establish whether a WPT test or implementation bug should follow.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.