Skip to content

Commit fdaa68a

Browse files
Update src/task-lists-element.ts
Co-authored-by: Kristján Oddsson <koddsson@gmail.com>
1 parent 63e5795 commit fdaa68a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/task-lists-element.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,8 @@ 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 index = item
136-
? Array.from(list.children)
137-
.filter(el => el.classList.contains('task-list-item'))
138-
.indexOf(item)
139-
: -1
135+
const listItems = Array.from(list.children).filter(el => el.classList.contains('task-list-item'))
136+
const index = item ? listItems.indexOf(item) : -1
140137
return [listIndex(list), index]
141138
}
142139

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