Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/ratchet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2016-03-07 13:28:35 +0300
committerXhmikosR <xhmikosr@gmail.com>2016-03-07 13:28:35 +0300
commitd6f0e735534a7301424e6d08b4f0d3c8f1ffe961 (patch)
tree41a4dd3939725e9027b866cab0982048262e2b19
parent8302173414dc403a628508329e81f46c2ef5da70 (diff)
parent9ed213b437f09c06c13720e8df037d2021d6164d (diff)
Merge pull request #823 from Johann-S/fixModalEvent
Create new event to avoid warning in Jasmine
-rw-r--r--js/modals.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/js/modals.js b/js/modals.js
index db4f5bc..0012ca1 100644
--- a/js/modals.js
+++ b/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');