In order for custom selection to work, I have to change the layout of the document in the sense that each line will be a seperate div element, not seperated by <br/>
Getting there with the application provided selections. Words of a line are now inside a line element. Along with the new formatting, word wrap and page breaks have changed to work with it.