From 802ed406e65072fc83aee402a5aa86523c530b4d Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Wed, 22 Mar 2017 15:42:38 +0800 Subject: Fix todo list item class might add in wrong element --- public/js/extra.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/js/extra.js b/public/js/extra.js index ffd95a27..d237a2f2 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -253,7 +253,11 @@ export function finishView (view) { if (/^\s*\[[x ]\]\s*/.test(html)) { li.innerHTML = html.replace(/^\s*\[ \]\s*/, ``) .replace(/^\s*\[x\]\s*/, ``) - li.setAttribute('class', 'task-list-item') + if (li.tagName.toLowerCase() !== 'li') { + li.parentElement.setAttribute('class', 'task-list-item') + } else { + li.setAttribute('class', 'task-list-item') + } } if (typeof editor !== 'undefined' && window.havePermission()) { $(li).find('input').change(toggleTodoEvent) } // color tag in list will convert it to tag icon with color -- cgit v1.2.3