Create new event to avoid warning in Jasmine
This commit is contained in:
Родитель
b98f88bff5
Коммит
9ed213b437
21
js/modals.js
21
js/modals.js
|
@ -9,14 +9,6 @@
|
|||
!(function () {
|
||||
'use strict';
|
||||
|
||||
var eventModalOpen = new CustomEvent('modalOpen', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
var eventModalClose = new CustomEvent('modalClose', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
var findModals = function (target) {
|
||||
var i;
|
||||
var modals = document.querySelectorAll('a');
|
||||
|
@ -40,9 +32,18 @@
|
|||
window.addEventListener('touchend', function (event) {
|
||||
var modal = getModal(event);
|
||||
if (modal && modal.classList.contains('modal')) {
|
||||
var eventToDispatch = eventModalOpen;
|
||||
var eventToDispatch = null;
|
||||
if (modal.classList.contains('active')) {
|
||||
eventToDispatch = eventModalClose;
|
||||
eventToDispatch = new CustomEvent('modalClose', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
}
|
||||
else {
|
||||
eventToDispatch = new CustomEvent('modalOpen', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
}
|
||||
modal.dispatchEvent(eventToDispatch);
|
||||
modal.classList.toggle('active');
|
||||
|
|
Загрузка…
Ссылка в новой задаче