[csswg-drafts] [css-highlight-api] In examples 2 and 3, setStart and setEnd fail (#6032)

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

== [css-highlight-api] In examples 2 and 3, setStart and setEnd fail ==
In examples 2 and 3 from the [draft](https://www.w3.org/TR/css-highlight-api-1/), the Ranges are built using document.body as start/end node. This node is of Element type, so the offset passed to setStart/setEnd is actually the number of child nodes between the start of document.body and not the number of characters. As a result, the browser fails to execute setStart and setEnd when the offset is greater than 1.

One possible fix for this could be writing document.body.childNodes[0] instead of document.body. In this way the offset is representing the number of characters since the start of the text node as intended.


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


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

Received on Monday, 22 February 2021 20:02:59 UTC