Skip to content

Commit

Permalink
Merge pull request #300 from timjnh/master
Browse files Browse the repository at this point in the history
Resolve a memory leak due to an event handler that isn't cleaned up in destroy()
  • Loading branch information
vitch committed Apr 25, 2015
2 parents da7573f + 711377b commit ffe3654
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion script/jquery.jscrollpane.js
Expand Up @@ -937,7 +937,8 @@
isScrollableV && validParents.push(verticalBar[0]);

// IE also focuses elements that don't have tabindex set.
pane.focus(
pane.bind(
'focus.jsp',
function()
{
elem.focus();
Expand Down Expand Up @@ -1036,6 +1037,8 @@
elem.attr('tabindex', '-1')
.removeAttr('tabindex')
.unbind('keydown.jsp keypress.jsp');

pane.unbind('.jsp');
}

function observeHash()
Expand Down Expand Up @@ -1208,6 +1211,7 @@
var currentY = contentPositionY(),
currentX = contentPositionX();
elem.removeClass('jspScrollable').unbind('.jsp');
pane.unbind('.jsp');
elem.replaceWith(originalElement.append(pane.children()));
originalElement.scrollTop(currentY);
originalElement.scrollLeft(currentX);
Expand Down

0 comments on commit ffe3654

Please sign in to comment.