javascript
Measuring the y-position of selected text
Measuring the position of selected text is pretty tricky. Its easy to calculate the position of the container, but this is often unprecise, because paragraphs can be very long.
The position can for example be used to scroll the selection into view.
Here is how I solved it. It only works in firefox, but it should be pretty easy to convert.
rosell.dk