replace while with forEach loop
This commit is contained in:
parent
a4dc1c6440
commit
387455b755
26
js/reveal.js
26
js/reveal.js
@ -2991,14 +2991,11 @@
|
|||||||
element.classList.add( reverse ? 'future' : 'past' );
|
element.classList.add( reverse ? 'future' : 'past' );
|
||||||
|
|
||||||
if( config.fragments ) {
|
if( config.fragments ) {
|
||||||
var pastFragments = toArray( element.querySelectorAll( '.fragment' ) );
|
// Show all fragments in prior slides
|
||||||
|
toArray( element.querySelectorAll( '.fragment' ) ).forEach( function( fragment ) {
|
||||||
// Show all fragments on prior slides
|
fragment.classList.add( 'visible' );
|
||||||
while( pastFragments.length ) {
|
fragment.classList.remove( 'current-fragment' );
|
||||||
var pastFragment = pastFragments.pop();
|
} );
|
||||||
pastFragment.classList.add( 'visible' );
|
|
||||||
pastFragment.classList.remove( 'current-fragment' );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( i > index ) {
|
else if( i > index ) {
|
||||||
@ -3006,14 +3003,11 @@
|
|||||||
element.classList.add( reverse ? 'past' : 'future' );
|
element.classList.add( reverse ? 'past' : 'future' );
|
||||||
|
|
||||||
if( config.fragments ) {
|
if( config.fragments ) {
|
||||||
var futureFragments = toArray( element.querySelectorAll( '.fragment.visible' ) );
|
// Hide all fragments in future slides
|
||||||
|
toArray( element.querySelectorAll( '.fragment.visible' ) ).forEach( function( fragment ) {
|
||||||
// No fragments in future slides should be visible ahead of time
|
fragment.classList.remove( 'visible' );
|
||||||
while( futureFragments.length ) {
|
fragment.classList.remove( 'current-fragment' );
|
||||||
var futureFragment = futureFragments.pop();
|
} );
|
||||||
futureFragment.classList.remove( 'visible' );
|
|
||||||
futureFragment.classList.remove( 'current-fragment' );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user