[w3c/selection-api] `selectionchange` fires differently across the browser engines (Issue #332)

During a code execution, the Selection API's boundary-points can change multiple times.
For example:
```
const sel = getSelection();
...
sel.removeAllRanges();
sel.addRange(range1);
...
sel.removeAllRanges();
sel.addRange(range2)
```

The [spec](https://www.w3.org/TR/selection-api/#selectionchange-event) does not specify how many times the `selectionchange` event should fire if we change the selection multiple times before the macrotask queue gets executed.

Demo to reproduce: https://codepen.io/IDontHaveAny/pen/OJemybj

In Chromium and WebKit, the `selectionchange` fires multiple times, even though the `Selecion` will be the same by the time it gets executed.
In Gecko, it fires once.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/332
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/selection-api/issues/332@github.com>

Received on Friday, 2 August 2024 21:23:50 UTC