diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-04-27 15:04:37 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-04-27 15:04:37 +0200 |
commit | c58096ea991771425f61b9a3a6fc0de8abab07d6 (patch) | |
tree | ca3230ad5f2d0c1b503bc6f9ded008dc366dfb7a | |
parent | 902e36c0228478083d9f2ef487c12f9de401d404 (diff) | |
download | fosdem-2018-presentation-c58096ea991771425f61b9a3a6fc0de8abab07d6.tar fosdem-2018-presentation-c58096ea991771425f61b9a3a6fc0de8abab07d6.tar.gz |
disregard v index when there is no vertical slides/backgrounds in getSlide/getSlideBackground
-rw-r--r-- | js/reveal.js | 7 |
1 files 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; } |