If you select any text below beginning at the first character H, it will say the baseOffset of the selection is 5. In my real-life case it says 7. How do I correct this?
setInterval(()=>{
console.log(window.getSelection().baseOffset);
}, 250);
<!DOCTYPE html>
<html>
<body>
<div id='main'data-alignment="center">
Hello World!
</div>
</body>
</html>