diff --git a/Sortable.js b/Sortable.js index 6395215..3176f3a 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; }