We need to detect whether ellipsis is really applied, then to show a tooltip to reveal full text. It is not enough by only comparing "this.offsetWidth < this.scrollWidth
" when the element nearly holding its content but only lacking one or two more pixels in width, especially for the text of full-width Chinese/Japanese/Korean characters.
Here is an example: http://jsfiddle.net/28r5D/5/
I found a way to improve ellipsis detection:
this.offsetWidth < this.scrollWidth
" first, continue step #2 if failed.Here is my improvement: http://jsfiddle.net/28r5D/6/