w3c / selection-api

Selection API
http://w3c.github.io/selection-api/
Other
46 stars 28 forks source link

interop: Trailing whitespace in h1/h2 is selectable in firefox, not selectable in chrome #149

Open untitaker opened 2 years ago

untitaker commented 2 years ago

Repro case:

<h1>hello world </h1>

your selection:

<div id=selection />

<script>
    window.setInterval(() => {
        document.getElementById("selection").innerText = "'" + window.getSelection() + "'";
    }, 100);
</script>

there is trailing whitespace in "hello world". That whitespace can be selected in Firefox and is reflected in the selection API, but not in Chrome, and so it is not.

I originally opened https://github.com/whatwg/html/issues/8003, but it was suggested that this is a better place to file this issue.