From 5325c8a84224f231578f092ca56382480652cc91 Mon Sep 17 00:00:00 2001 From: Markus Ast Date: Tue, 27 Jan 2015 16:41:11 +0100 Subject: [PATCH] fix index calculation to skip templates --- Sortable.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 60cd0bd..153cf1b 100644 --- a/Sortable.js +++ b/Sortable.js @@ -949,8 +949,10 @@ */ function _index(/**HTMLElement*/el) { var index = 0; - while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) { - index++; + while (el && (el = el.previousElementSibling)) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE') { + index++; + } } return index; }