Skip to content

Commit aa72548

Browse files
committed
Fix index - base index off all list items and not just lists of the same parent
1 parent 4fa8d9a commit aa72548

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/task-lists-element.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ function syncDisabled(list: TaskListsElement) {
187187
// lists in the container, not just task lists, are indexed to match the
188188
// server-side Markdown parser's indexing.
189189
function listIndex(list: Element): number {
190-
const container = list.parentElement
190+
const container = list.closest('task-lists')
191191
if (!container) throw new Error('parent not found')
192-
const top = Array.from(container.children).filter(el => el.nodeName === 'OL' || el.nodeName === 'UL')
192+
const top = Array.from(container.querySelectorAll('ol, ul'))
193193
return top.indexOf(list)
194194
}
195195

0 commit comments

Comments
 (0)