From 34b298781686ddbcce88b785b109d0daa055a6ce Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 26 Jun 2020 10:36:13 +0200 Subject: [PATCH] Fix type error with comments --- www/pad/comment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/pad/comment.js b/www/pad/comment.js index 996b153dd..1a059a50e 100644 --- a/www/pad/comment.js +++ b/www/pad/comment.js @@ -44,7 +44,8 @@ path = path || editor.elementPath(); sel = sel || editor.getSelection(); var applicable = removeStyle.checkApplicable(path, editor); - var hasComments = editor.getSelectedHtml().$.querySelectorAll('comment').length; + var el = editor.getSelectedHtml().$; + var hasComments = el && el.querySelectorAll('comment').length; var isComment = removeStyle.checkActive(path, editor); var empty = !sel.getSelectedText(); return applicable && !empty && !hasComments && !isComment;