Skip to content
This repository was archived by the owner on Mar 10, 2024. It is now read-only.
This repository was archived by the owner on Mar 10, 2024. It is now read-only.

Performance issue in the dragover event of the dndLists directive. #413

@johntdowney

Description

@johntdowney

Hey, just leaving this here for the author and/or those who care because I spent a little while solving this issue while working with a very large drag and drop list.

Line 339/340 is as follows:

listNode.insertBefore(placeholderNode,
	isFirstHalf ? listItemNode : listItemNode.nextSibling);

Replacing these two lines with

if(isFirstHalf) {
	if(listItemNode.previousSibling != placeholderNode) listNode.insertBefore(placeholderNode, listItemNode);
} else {
	if(listItemNode.nextSibling != placeholderNode) listNode.insertBefore(placeholderNode, listItemNode.nextSibling);
}

dramatically cuts down on the number of DOM layouts and improves the execution time of the dragover event handler. Without this, it's pretty hobbled at around ~60 dnd list items.

Thanks,
John Downey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions