Skip to content

Commit 3eba7a6

Browse files
mr-migKristján Oddsson
authored andcommitted
Change the logic for calculating item position
Use tagName === `LI` to calculate item position within a list
1 parent a069828 commit 3eba7a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/task-lists-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function position(checkbox: HTMLInputElement): [number, number] {
132132
const list = taskList(checkbox)
133133
if (!list) throw new Error('.contains-task-list not found')
134134
const item = checkbox.closest('.task-list-item')
135-
const listItems = Array.from(list.children).filter(el => el.classList.contains('task-list-item'))
135+
const listItems = Array.from(list.children).filter(el => el.tagName === 'LI')
136136
const index = item ? listItems.indexOf(item) : -1
137137
return [listIndex(list), index]
138138
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy