Fixed an error in the onDragOver function in drag-and-drop-reorder.js that sometimes the dragged object may be null.

This commit is contained in:
依瑪貓 2023-02-26 07:42:36 +08:00
parent 5a6e4f5b5e
commit 652bddc07a

View File

@ -91,7 +91,7 @@ function initializeTouchDragAndDropReordering(list, onReorder) {
* @param target {Element} the other item that was dragged over
*/
function onDragOver(dragged, target) {
if (target.parentElement !== dragged.parentElement || target === dragged) {
if (dragged === null || target.parentElement !== dragged.parentElement || target === dragged) {
return;
}
let isBefore = false;