|
|
@ -626,17 +626,19 @@ |
|
|
|
// Remove event
|
|
|
|
// Remove event
|
|
|
|
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (dragEl.nextSibling !== nextEl) { |
|
|
|
else { |
|
|
|
// (1) Remove clone
|
|
|
|
// Remove clone
|
|
|
|
cloneEl && cloneEl.parentNode.removeChild(cloneEl); |
|
|
|
cloneEl && cloneEl.parentNode.removeChild(cloneEl); |
|
|
|
|
|
|
|
|
|
|
|
// (2) Get the index of the dragged element within its parent
|
|
|
|
if (dragEl.nextSibling !== nextEl) { |
|
|
|
|
|
|
|
// Get the index of the dragged element within its parent
|
|
|
|
newIndex = _index(dragEl); |
|
|
|
newIndex = _index(dragEl); |
|
|
|
|
|
|
|
|
|
|
|
// drag & drop within the same list
|
|
|
|
// drag & drop within the same list
|
|
|
|
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'update', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
_dispatchEvent(rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Drag end event
|
|
|
|
// Drag end event
|
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
|
Sortable.active && _dispatchEvent(rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); |
|
|
@ -819,7 +821,7 @@ |
|
|
|
do { |
|
|
|
do { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
(tag === '>*' && el.parentNode === ctx) || ( |
|
|
|
(tag === '>*' && el.parentNode === ctx) || ( |
|
|
|
(tag === '' || el.nodeName == tag) && |
|
|
|
(tag === '' || el.nodeName.toUpperCase() == tag) && |
|
|
|
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) |
|
|
|
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
@ -947,7 +949,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
function _index(/**HTMLElement*/el) { |
|
|
|
var index = 0; |
|
|
|
var index = 0; |
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { |
|
|
|
while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) { |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
return index; |
|
|
|
return index; |
|
|
@ -993,7 +995,7 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sortable.version = '1.0.0'; |
|
|
|
Sortable.version = '1.0.1'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|