rviscomi / trunk8

jQuery Truncation Plugin -- THIS PROJECT IS NO LONGER MAINTAINED
MIT License
703 stars 95 forks source link

Trim extra whitespace when getting original text #31

Closed dillonforrest closed 9 years ago

dillonforrest commented 11 years ago

I have a situation where I'm using a template to render html, then using trunk8 on the html. In my html template:

<div class='to-be-truncated'>
    {{insert_data_into_template}}
</div>

Note the newlines. I did NOT have that whole div on one line. Because of that, trunk8 inserted a tooltip with those extra newlines as well. Of course, I ended up just putting my entire div on one line to fix the issue. But I figured I'd submit this PR anyway. It might be useful to others. So, I trimmed out the extra newlines. What do you guys think?