- From: Sebastian Zartner via GitHub <noreply@w3.org>
- Date: Sun, 14 Sep 2025 00:52:48 +0000
- To: public-css-archive@w3.org
The use cases I had in mind focus more on the geometry and indirectly the count of the line boxes. Exposing the text of the different line boxes sounds like a reasonable use case. Though that should then not be based on DOMRects, as they are purely geometrical. And only the plain text as a string would be needed, because you can get the character count via `length`. And it probably also wouldn't be text node in form of a `Text` interface, because the fragments are presentational and not actually DOM nodes. There are also different approaches for that I can think of: ## 1. Change returned value of `getClientRects()` Instead of returning a `DOMRectList` that holds a number of `DOMRect` objects, it could return a list of line box objects. Those line box objects need to inherit from the `DOMRect` interface, so it extends the existing return value and is backwards compatible. Advantage: * Reuses existing API Disadvantage: * Text always exposed even when not needed (in geometry or line count centered use cases) ## 2. Introduce a new API exposing only text fragments That method would expose a list of text fragments without any geometrical information. Those text fragments would reflect the different lines as strings within an element. Advantage: * Focuses on a single use case Disadvantage * Very limited in its usage ## 3. Introduce a new API exposing line boxes Instead of extending `getClientRects()`, a new method could be introduced that works the same as in option 1, i.e. returning a list of line box objects. Advantage: * Information is only exposed when required Disadvantage: * One more API that exposes similar data as existing APIs Sebastian -- GitHub Notification of comment by SebastianZ Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9433#issuecomment-3289028316 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 14 September 2025 00:52:48 UTC