From c58096ea991771425f61b9a3a6fc0de8abab07d6 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Sun, 27 Apr 2014 15:04:37 +0200 Subject: [PATCH] disregard v index when there is no vertical slides/backgrounds in getSlide/getSlideBackground --- js/reveal.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index 2c87c87..d0c8272 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2645,12 +2645,15 @@ var Reveal = (function(){ } + /** + * Returns the slide element matching the specified index. + */ function getSlide( x, y ) { var horizontalSlide = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR )[ x ]; var verticalSlides = horizontalSlide && horizontalSlide.querySelectorAll( 'section' ); - if( typeof y === 'number' ) { + if( verticalSlides && verticalSlides.length && typeof y === 'number' ) { return verticalSlides ? verticalSlides[ y ] : undefined; } @@ -2669,7 +2672,7 @@ var Reveal = (function(){ var horizontalBackground = document.querySelectorAll( '.backgrounds>.slide-background' )[ x ]; var verticalBackgrounds = horizontalBackground && horizontalBackground.querySelectorAll( '.slide-background' ); - if( typeof y === 'number' ) { + if( verticalBackgrounds && verticalBackgrounds.length && typeof y === 'number' ) { return verticalBackgrounds ? verticalBackgrounds[ y ] : undefined; }