diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-10-11 11:32:16 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2018-10-11 11:32:16 +0200 |
commit | 387455b755b2cf537130e321e1e04f291b3062d2 (patch) | |
tree | 510b3ddc4e9acb2fac47558d5d4eb82e5749910e | |
parent | a4dc1c64400bea2f88b175fce7a8d0a009209d37 (diff) | |
download | freenode-live-2017-presentation-387455b755b2cf537130e321e1e04f291b3062d2.tar freenode-live-2017-presentation-387455b755b2cf537130e321e1e04f291b3062d2.tar.gz |
replace while with forEach loop
-rw-r--r-- | js/reveal.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/js/reveal.js b/js/reveal.js index 6c11540..d78d3a9 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -2991,14 +2991,11 @@ element.classList.add( reverse ? 'future' : 'past' ); if( config.fragments ) { - var pastFragments = toArray( element.querySelectorAll( '.fragment' ) ); - - // Show all fragments on prior slides - while( pastFragments.length ) { - var pastFragment = pastFragments.pop(); - pastFragment.classList.add( 'visible' ); - pastFragment.classList.remove( 'current-fragment' ); - } + // Show all fragments in prior slides + toArray( element.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) { + fragment.classList.add( 'visible' ); + fragment.classList.remove( 'current-fragment' ); + } ); } } else if( i > index ) { @@ -3006,14 +3003,11 @@ element.classList.add( reverse ? 'past' : 'future' ); if( config.fragments ) { - var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) ); - - // No fragments in future slides should be visible ahead of time - while( futureFragments.length ) { - var futureFragment = futureFragments.pop(); - futureFragment.classList.remove( 'visible' ); - futureFragment.classList.remove( 'current-fragment' ); - } + // Hide all fragments in future slides + toArray( element.querySelectorAll( '.fragment.visible' ) ).forEach( function( fragment ) { + fragment.classList.remove( 'visible' ); + fragment.classList.remove( 'current-fragment' ); + } ); } } } |