jquery-scroll
jquery-scroll copied to clipboard
unscrollbar was deleting text and doubling content
The unscrollbar function wasn't working correctly. It fetched everything except text nodes, but including children of children. So all text was missing while other elements where doubled.
Just got bitten by this too:
I think the cleanest approach is to just change line 497 to:
var holder = this.container.find('.scrollbar-pane').children().clone(true);
creating an in-memory copy before cleaning up the dom and then reinserting.
I don't have anything in mind, but I think .children() does not copy text nodes. That's why I use .content(). Let me if I miss something.
You are right of course: you need to use contents()
not children()
, but I still think the approach is valid. Since I'm using the same lookup as you, I'd also need :first
on my "scrollbar-pane"-selector giving me:
var holder = this.container.find('.scrollbar-pane:first').contents().clone(true);
You are right. Your approach should fix the issue and looks a lot cleaner. I pushed the changes to my repository.