From 31df556d1e37006c392a6d6b912dd924e35027ae Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Mon, 26 Sep 2011 15:29:05 +0200 Subject: [PATCH 1/6] 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. --- jquery.scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.scroll.js b/jquery.scroll.js index fd80020..7668976 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -494,7 +494,7 @@ Changelog: // Remove scrollbar dom elements // unscrollbar: function() { - var holder = this.container.find('.scrollbar-pane').find('*'); + var holder = this.container.find('.scrollbar-pane').contents(); this.container.empty(); this.container.append(holder); this.container.attr('style',''); From dddeaad4c16f9b78a39182c972e788168833b3d5 Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Mon, 26 Sep 2011 16:14:38 +0200 Subject: [PATCH 2/6] reference to old scrollbar object wasn't cleared. --- jquery.scroll.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.scroll.js b/jquery.scroll.js index 7668976..7d46943 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -184,6 +184,7 @@ Changelog: return this.each(function() { if(this.scrollbar) { this.scrollbar.unscrollbar(); + this.scrollbar = null; } }); } From d80ac1d38fc78baeb632758a9d458a322d432a33 Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Thu, 29 Sep 2011 15:20:39 +0200 Subject: [PATCH 3/6] In case of nested scrollbar-panes the content of all scrollbar-panes got attached to the root pane. --- jquery.scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.scroll.js b/jquery.scroll.js index 7d46943..2d808f6 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -495,7 +495,7 @@ Changelog: // Remove scrollbar dom elements // unscrollbar: function() { - var holder = this.container.find('.scrollbar-pane').contents(); + var holder = this.container.find('.scrollbar-pane :first').contents(); this.container.empty(); this.container.append(holder); this.container.attr('style',''); From 3efd37bb3205f8a5598e8384d97a2cbf693f8b34 Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Thu, 29 Sep 2011 15:33:27 +0200 Subject: [PATCH 4/6] wrong selector --- jquery.scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.scroll.js b/jquery.scroll.js index 2d808f6..87eb8b7 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -495,7 +495,7 @@ Changelog: // Remove scrollbar dom elements // unscrollbar: function() { - var holder = this.container.find('.scrollbar-pane :first').contents(); + var holder = this.container.find('.scrollbar-pane:first').contents(); this.container.empty(); this.container.append(holder); this.container.attr('style',''); From b0967e8177b37efc41e79e00c0a2f795ff635e81 Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Thu, 29 Sep 2011 16:15:24 +0200 Subject: [PATCH 5/6] Cleaner approach since .empty() removes data and event handlers. The jQuery documentation says: "To avoid memory leaks, jQuery removes other constructs such as data and event handlers from the child elements before removing the elements themselves." --- jquery.scroll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.scroll.js b/jquery.scroll.js index 87eb8b7..2097762 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -495,9 +495,9 @@ Changelog: // Remove scrollbar dom elements // unscrollbar: function() { - var holder = this.container.find('.scrollbar-pane:first').contents(); - this.container.empty(); - this.container.append(holder); + var holder = this.container.find('.scrollbar-pane:first'); + this.container.children().not('.scrollbar-pane').remove(); + holder.replaceWith(holder.contents()); this.container.attr('style',''); }, From 91cc2f1e0666933cc48dad9e6da8762fd0c3bf63 Mon Sep 17 00:00:00 2001 From: Felix Rosenheinrich Date: Thu, 12 Apr 2012 13:08:41 +0200 Subject: [PATCH 6/6] Reverts changes and adds .clone to the scrollpanes conent as proposed by wagich. Revert "In case of nested scrollbar-panes the content of all scrollbar-panes got attached to the root pane." This reverts commit d80ac1d38fc78baeb632758a9d458a322d432a33. --- jquery.scroll.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.scroll.js b/jquery.scroll.js index 2097762..c57c922 100644 --- a/jquery.scroll.js +++ b/jquery.scroll.js @@ -495,9 +495,9 @@ Changelog: // Remove scrollbar dom elements // unscrollbar: function() { - var holder = this.container.find('.scrollbar-pane:first'); - this.container.children().not('.scrollbar-pane').remove(); - holder.replaceWith(holder.contents()); + var holder = this.container.find('.scrollbar-pane:first').contents().clone(true); + this.container.empty(); + this.container.append(holder); this.container.attr('style',''); },