kswedberg / jquery-expander

Expand and Collapse HTML content

Home Page:https://kswedberg.github.io/jquery-expander/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

preserveWords option not working on serialized data.

pascallapointe opened this issue · comments

preserveWords option not working on serialized data. The script isn't able to truncate the text cause it got only one long word without any white spaces.

Usage of lastIndexOf function may be the issue source cause the script try to slice from index 0 to 0.

Thanks for the report! Can you point me to a simplified example that demonstrates the problem? It'll be a lot easier for me to troubleshoot the problem if I can add the script and html into my tests.

Sure, I'll provide a JsFiddle test as soon as I got time to do it! The Post-it is on the 'todo' zone of my desk!

Since it is no bug and more a specific use case that fit my needs, I'll try to propose some solution at the same time.

ok. thanks a lot!

Here's a small test with a serialized object. (Can also be the case if the script face a text with non breakable space ( ))

http://jsfiddle.net/pascallapointe/sBNYF/2/

Problem's found, my fault! I should have read your doc better. You can close this issue.

Since serialized data can be displayed as a long words, there's only one word is found after the break point.
Just had to set the current parameter to zero or one:

widow: 1

Oh, wonderful. I probably should have thought to ask you about that option, but I'm so glad you figured it out!