jquery-scroll icon indicating copy to clipboard operation
jquery-scroll copied to clipboard

unscrollbar was deleting text and doubling content

Open khujo opened this issue 13 years ago • 4 comments

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.

khujo avatar Sep 26 '11 13:09 khujo

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.

wagich avatar Apr 02 '12 16:04 wagich

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.

khujo avatar Apr 12 '12 07:04 khujo

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);

wagich avatar Apr 12 '12 08:04 wagich

You are right. Your approach should fix the issue and looks a lot cleaner. I pushed the changes to my repository.

khujo avatar Apr 12 '12 11:04 khujo