Detect where the text wraps in Javascript