MarcDiethelm/jQuery-Shorten — Issue #8: Tooltip doesn't get updated sometimes
Author: chrisbartley
Created: 2012-02-23 23:10:34+00:00
State: open

First, thanks for this plugin.

I found an issue with the setting of the tooltip, however. It doesn't get updated if the text changes such that its new length fits within the target width. The problem is the `return true;` within this first if block is preventing the execution of the tooltip if block:

```javascript
if (origLength < targetWidth) {
//$c.log("nothing to do");
$this.text(text);
this.style.visibility = "visible";

$this.data(info_identifier, info);

return true;
}

if (options.tooltip) {
this.setAttribute("title", text);
}
```
Simply moving the if block which checks the tooltip option up above the width-checking if block fixes the problem.

Chris