Change the logic for calculating item position
Use tagName === `LI` to calculate item position within a list
This commit is contained in:
Родитель
a0698284f8
Коммит
3eba7a6e4a
|
@ -132,7 +132,7 @@ function position(checkbox: HTMLInputElement): [number, number] {
|
|||
const list = taskList(checkbox)
|
||||
if (!list) throw new Error('.contains-task-list not found')
|
||||
const item = checkbox.closest('.task-list-item')
|
||||
const listItems = Array.from(list.children).filter(el => el.classList.contains('task-list-item'))
|
||||
const listItems = Array.from(list.children).filter(el => el.tagName === 'LI')
|
||||
const index = item ? listItems.indexOf(item) : -1
|
||||
return [listIndex(list), index]
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче