Fix stylelint error message timer

This commit is contained in:
Rob Garrison 2017-08-20 09:31:25 -05:00
parent 7c5b4c2bcf
commit dded798ee3
2 changed files with 5 additions and 5 deletions

View File

@ -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);
}
}

View File

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