As you can see, clicking button1 and button2 results in a wider range than expected, while clicking button3 works as expected.
Expected behavior
Currently, markSelectedContent incorrectly handle situations when range.startContainer === range.endContainer, which commonly occurs with the output of Range#selectNode. This problem should be fixed to facilitate automation.
Describe the bug Using Range API to make a selection, the 'Save selection' menu results in a wider range than expected.
To Reproduce I‘ve made an example to illustrate this problem:
As you can see, clicking
button1
andbutton2
results in a wider range than expected, while clickingbutton3
works as expected.Expected behavior
Currently,
markSelectedContent
incorrectly handle situations whenrange.startContainer === range.endContainer
, which commonly occurs with the output ofRange#selectNode
. This problem should be fixed to facilitate automation.One feasible fix might be like:
Environment