From f61ee9a693dc6fc167c65665a3e17de9566ffe9b Mon Sep 17 00:00:00 2001
From: Hakim El Hattab
Date: Thu, 22 Aug 2013 19:35:21 -0400
Subject: fix bug where isLastSlide sometimes incorrectly returned false

---
 js/reveal.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'js/reveal.js')

diff --git a/js/reveal.js b/js/reveal.js
index e7860ff..fabcded 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2759,12 +2759,17 @@ var Reveal = (function(){
 
 		// Returns true if we're currently on the last slide
 		isLastSlide: function() {
-			if( currentSlide && currentSlide.classList.contains( '.stack' ) ) {
-				return currentSlide.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
-			}
-			else {
-				return document.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
+			if( currentSlide ) {
+				// Does this slide has next a sibling?
+				if( currentSlide.nextElementSibling ) return false;
+
+				// If it's vertical, does its parent have a next sibling?
+				if( isVerticalSlide( currentSlide ) && currentSlide.parentNode.nextElementSibling ) return false;
+
+				return true;
 			}
+
+			return false;
 		},
 
 		// Checks if reveal.js has been loaded and is ready for use
-- 
cgit v1.2.3