Skip to content

Commit

Permalink
make extra removeNode call to ensure that moved nodes are disposed pr…
Browse files Browse the repository at this point in the history
…operly in KO 3+ fixes #104
  • Loading branch information
rniemeyer committed Jun 16, 2014
1 parent 9323854 commit 451880d
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 106 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "knockout-sortable",
"version": "0.8.6",
"version": "0.8.7",
"main": "./build/knockout-sortable.min.js",
"ignore": [
"examples",
Expand Down
7 changes: 5 additions & 2 deletions build/knockout-sortable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// knockout-sortable 0.8.6 | (c) 2014 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
// knockout-sortable 0.8.7 | (c) 2014 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
;(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD anonymous module
Expand Down Expand Up @@ -191,7 +191,7 @@
if (arg.cancelDrop) {
//call cancel on the correct list
if (arg.sourceParent) {
$(arg.sourceParent === arg.targetParent ? this : ui.sender).sortable('cancel');
$(arg.sourceParent === arg.targetParent ? this : ui.sender).sortable("cancel");
}
//for a draggable item just remove the element
else {
Expand All @@ -206,6 +206,9 @@
if (sourceParent) {
sourceParent.splice(sourceIndex, 1);

//in KO 3+, nodes outside of the original parent aren't found when trying to dispose, need to do this manually
ko.removeNode(el);

//if using deferred updates plugin, force updates
if (ko.processAllDeferredBindingUpdates) {
ko.processAllDeferredBindingUpdates();
Expand Down
4 changes: 2 additions & 2 deletions build/knockout-sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/connectedLists.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.0.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.1.0.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>

<style type='text/css'>
Expand Down
2 changes: 1 addition & 1 deletion examples/draggable.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.0.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.1.0.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>

<style type='text/css'>
Expand Down
2 changes: 1 addition & 1 deletion examples/seatingChart.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>
<script type='text/javascript' src="../ext/knockout-3.0.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.1.0.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.min.js"></script>
<script type='text/javascript' src="seatingChart.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion examples/singleList.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script type='text/javascript' src='../ext/jquery-1.9.1.js'></script>
<script type="text/javascript" src="../ext/jquery-ui.js"></script>

<script type='text/javascript' src="../ext/knockout-3.0.0.js"></script>
<script type='text/javascript' src="../ext/knockout-3.1.0.js"></script>
<script type='text/javascript' src="../build/knockout-sortable.js"></script>

<style type='text/css'>
Expand Down
Loading

0 comments on commit 451880d

Please sign in to comment.