guard against a few possible typeErrors

pull/1/head
ansuz 5 years ago
parent 6a8ab6bc55
commit d5d30c2e09

@ -56,7 +56,10 @@
path = path || editor.elementPath();
sel = sel || editor.getSelection();
var applicable = removeStyle.checkApplicable(path, editor);
var hasComments = editor.getSelectedHtml().$.querySelectorAll('comment').length;
var selectedHtml = editor.getSelectedHtml();
if (selectedHtml === null) { return; }
var comments = selectedHtml.$.querySelectorAll('comment');
var hasComments = comments && comments.length;
var isComment = removeStyle.checkActive(path, editor);
var empty = !sel.getSelectedText();
return applicable && !empty && !hasComments && !isComment;

Loading…
Cancel
Save