Global 'event' var is non-standard, FF doesn't support it

This commit is contained in:
tophf 2017-03-20 01:58:10 +03:00
parent ba8301fdce
commit 1dde91ea85
2 changed files with 11 additions and 11 deletions

View File

@ -132,7 +132,7 @@ function enable(event, enabled) {
enableStyle(id, enabled); enableStyle(id, enabled);
} }
function doDelete() { function doDelete(event) {
if (!confirm(t('deleteStyleConfirm'))) { if (!confirm(t('deleteStyleConfirm'))) {
return; return;
} }

View File

@ -94,17 +94,17 @@ function createStyleElement(style) {
// reuse event function references // reuse event function references
createStyleElement.events = createStyleElement.events || { createStyleElement.events = createStyleElement.events || {
checkboxClick() { checkboxClick() {
enableStyle(getClickedStyleId(), this.checked); enableStyle(getClickedStyleId(event), this.checked);
}, },
styleNameClick() { styleNameClick(event) {
this.checkbox.click(); this.checkbox.click();
window.event.preventDefault(); event.preventDefault();
}, },
toggleClick() { toggleClick(event) {
enableStyle(getClickedStyleId(), this.matches('.enable')); enableStyle(getClickedStyleId(event), this.matches('.enable'));
}, },
deleteClick() { deleteClick() {
doDelete(); doDelete(event);
} }
}; };
const entry = template.style.cloneNode(true); const entry = template.style.cloneNode(true);
@ -144,9 +144,9 @@ function createStyleElement(style) {
return entry; return entry;
} }
function doDelete() { function doDelete(event) {
document.getElementById('confirm').dataset.display = true; document.getElementById('confirm').dataset.display = true;
const id = getClickedStyleId(); const id = getClickedStyleId(event);
document.querySelector('#confirm b').textContent = document.querySelector('#confirm b').textContent =
document.querySelector(`[style-id="${id}"] label`).textContent; document.querySelector(`[style-id="${id}"] label`).textContent;
document.getElementById('confirm').dataset.id = id; document.getElementById('confirm').dataset.id = id;
@ -168,8 +168,8 @@ document.getElementById('confirm').addEventListener('click', e => {
} }
}); });
function getClickedStyleId() { function getClickedStyleId(event) {
const entry = window.event.target.closest('.entry'); const entry = event.target.closest('.entry');
return entry ? entry.styleId : null; return entry ? entry.styleId : null;
} }