<!DOCTYPE html>
<html>
<head>
<style>
	::selection { color: green; }
</style>
</head>
<body>
<bdo id=target dir=rtl>neerg si noitceleS</bdo>
<script>
	let textNode = document.getElementById("target").firstChild;
	getSelection().setBaseAndExtent(textNode, 0, textNode, 5)
</script>
</body>
</html>
