- From: TAMURA, Kent <notifications@github.com>
- Date: Mon, 06 Mar 2017 16:06:29 -0800
- To: w3c/selection-api <selection-api@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 7 March 2017 00:07:12 UTC
```
<!DOCTYPE html>
<body><div></div><input value="initial"><div></div>
<script>
var sel = getSelection();
sel.removeAllRanges();
var i = document.querySelector('input');
i.setSelectionRange(1, 1);
alert('before focus: ' + sel.anchorNode + ' ' + sel.anchorOffset +
' ' + sel.focusNode + ' ' + sel.focusOffset);
i.focus();
alert('after focus: ' + sel.anchorNode + ' ' + sel.anchorOffset +
' ' + sel.focusNode + ' ' + sel.focusOffset);
</script>
</div>
```
| Firefox | Chrome | WebKit | Edge
-- | ------- | ------ | ------ | ----
before focus | null 0 null 0 | null 0 null 0 | body 1 body 1 | body 1 body 1
after focus | body 1 body 1 | body 1 body 1 | body 1 body 1 | body 1 body 1
It seems a difference is only how text control selection API works without focus.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/83#issuecomment-284576605
Received on Tuesday, 7 March 2017 00:07:12 UTC