kswedberg / jquery-expander

Expand and Collapse HTML content
https://kswedberg.github.io/jquery-expander/
Other
459 stars 168 forks source link

Bug around preserveWord = true #96

Open ttback opened 10 years ago

ttback commented 10 years ago

On Line 173: https://github.com/kswedberg/jquery-expander/blob/master/jquery.expander.js#L173

Shouldn't it be

summaryText = backup(summaryText, o.preserveWords && allHtml.slice(summaryText.length).length>0);

Current logic will ignore slicepoint when you set preserveword to true, basically truncating strings even if there's nothing to truncate.

kswedberg commented 10 years ago

Thanks for the report, @ttback . Would it be possible to provide an example of this failing? That way I can use it in my tests when I make a fix.

kswedberg commented 9 years ago

Any chance you can show me a snippet of html that fails?

ttback commented 9 years ago

@kswedberg sorry, never got around it, too busy hacking on some features. I don'r remember the particular example now, but I will try it with some example strings on Monday.

It is actually a very simple case, probably just any string that is shorter then truncate length would be truncated if you set 'preserveword' to be true.