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',