/* A row has just been indented or outdented. We're trying to find the new 'parent' of the row. Item B has just been moved. - Item - Item A - Item - Item - Item - Item C - Item B Item B was underneath Item C. Underneath Item C means there were 3 indents. Now it only has 1 indent. So we want Item B to find it's new parent, Item A. The final parent should end up in the 'sourceRow' variable. */ else if (rowSettings.relationship == 'parent') { var parents = this.indentCount - this.dragObject.indents; var previousRow = $(changedRow).prev(); while (parents > 0) { parents--; while (previousRow.length && $('.indentation', previousRow).length < (this.dragObject.indents - parents)) { previousRow = previousRow.prev(); } } sourceRow = previousRow[0] || changedRow; }