From dded798ee3ffc03d9030db3fdfea9339812028d9 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 20 Aug 2017 09:31:25 -0500 Subject: [PATCH] Fix stylelint error message timer --- edit/edit.js | 4 +++- edit/lint.js | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/edit/edit.js b/edit/edit.js index 1f997dba..b0f78539 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -1902,7 +1902,9 @@ function showHelp(title, body) { ((e.keyCode || e.which) === 27 && !e.altKey && !e.ctrlKey && !e.shiftKey && !e.metaKey) ) { div.style.display = ''; - document.querySelector('.contents').textContent = ''; + const contents = $('.contents'); + contents.textContent = ''; + clearTimeout(contents.timer); document.removeEventListener('keydown', closeHelp); } } diff --git a/edit/lint.js b/edit/lint.js index f782fb35..b14f259a 100644 --- a/edit/lint.js +++ b/edit/lint.js @@ -216,7 +216,6 @@ function showLintHelp() { } function setupStylelintSettingsEvents(popup) { - let timer; popup.querySelector('.save').addEventListener('click', event => { event.preventDefault(); const json = tryJSONparse(popup.codebox.getValue()); @@ -228,8 +227,8 @@ function setupStylelintSettingsEvents(popup) { } } else { $('#help-popup .error').classList.add('show'); - clearTimeout(timer); - timer = setTimeout(() => { + clearTimeout($('#help-popup .contents').timer); + $('#help-popup .contents').timer = setTimeout(() => { // popup may be closed at this point const error = $('#help-popup .error'); if (error) { @@ -267,7 +266,6 @@ function setupStylelintPopup(rules) { cm.setOption('lint', 'json'); } const popup = showCodeMirrorPopup(t('setStylelintRules'), $element({ - className: 'contents', appendChild: [ $element({ tag: 'p',