Use document.createRange instead