Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2015-12-03 08:22:47 -0500
committerMike Gerwitz <gerwitm@lovullo.com>2015-12-03 08:27:59 -0500
commit1a3dd236f8a55fbd24c3d11a0f03c0a1d57d0d15 (patch)
treebf6b89b6d016a7e0c1a2ce7aca41db090a12fa55
parentd6d42a6498d90b87a19825f5cedae47a78fb34e5 (diff)
downloadliza-1a3dd236f8a55fbd24c3d11a0f03c0a1d57d0d15.tar.gz
liza-1a3dd236f8a55fbd24c3d11a0f03c0a1d57d0d15.tar.bz2
liza-1a3dd236f8a55fbd24c3d11a0f03c0a1d57d0d15.zip
GeneralStepUi#_sortGroups: maintain DOM order after group sorting
This was affected by 4ce78ebd9eca890d1675bc592c7622a27f20f2a2.
-rw-r--r--src/ui/step/GeneralStepUi.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/ui/step/GeneralStepUi.js b/src/ui/step/GeneralStepUi.js
index 099f64d..6284878 100644
--- a/src/ui/step/GeneralStepUi.js
+++ b/src/ui/step/GeneralStepUi.js
@@ -1066,8 +1066,12 @@ module.exports = Class( 'StepUi' )
return;
}
- var parent = prev.parentNode,
+ // TODO: this makes the assumption that there is a parent node; we
+ // should not be concerned with that, and should find some other way
+ // of hiding the entire step while sorting (which the Ui handles)
+ var parent = this.$content[ 0 ].parentNode,
container = parent.parentNode,
+ sibling = parent.nextSibling,
i = len - 1;
if ( !container )
@@ -1117,8 +1121,15 @@ module.exports = Class( 'StepUi' )
}
// now that sorting is complete, re-add the groups in one large DOM
- // update
- container.appendChild( parent );
+ // update, maintaining element order
+ if ( sibling )
+ {
+ container.insertBefore( parent, sibling );
+ }
+ else
+ {
+ container.appendChild( parent );
+ }
callback();
}, 25 );