From: Ben Schwarz Date: Sat, 12 Jan 2013 23:59:18 +0000 (+1100) Subject: Correct turn of the modal window from getModal X-Git-Url: http://git.roojs.org/?p=ratchet;a=commitdiff_plain;h=ff3808b37b6f48da2b49ca57f14ed0bbeec26b1f Correct turn of the modal window from getModal * Looks like I hastily changed it during review with @fat. Oops! :-) --- diff --git a/lib/js/modals.js b/lib/js/modals.js index 51f0770..c796d48 100644 --- a/lib/js/modals.js +++ b/lib/js/modals.js @@ -8,7 +8,6 @@ var findModals = function (target) { var i; var modals = document.querySelectorAll('a'); - for (; target && target !== document; target = target.parentNode) { for (i = modals.length; i--;) { if (modals[i] === target) return target; } } @@ -16,7 +15,7 @@ var getModal = function (event) { var modalToggle = findModals(event.target); - if (!modalToggle || !modalToggle.hash) return document.querySelector(modalToggle.hash); + if (modalToggle && modalToggle.hash) return document.querySelector(modalToggle.hash); }; window.addEventListener('touchend', function (event) {