Procházet zdrojové kódy

respect original dom order of fragments with no explicit index

Hakim El Hattab před 11 roky
rodič
revize
c33aa66666
2 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. 10 0
      js/reveal.js
  2. 1 1
      js/reveal.min.js

+ 10 - 0
js/reveal.js

@@ -1045,10 +1045,20 @@ var Reveal = (function(){
 
 		var a = toArray( fragments );
 
+		// Elements that do not have an explicit `data-fragment-index`
+		// are given one which matches their order in the DOM
+		a.forEach( function( el, idx ) {
+			if( !el.hasAttribute( 'data-fragment-index' ) ) {
+				el.setAttribute( 'data-fragment-index', idx );
+			}
+		} );
+
 		a.sort( function( l, r ) {
 			return l.getAttribute( 'data-fragment-index' ) - r.getAttribute( 'data-fragment-index');
 		} );
 
+		// Set the indices to match the order of the sorted fragments,
+		// ensures that we're 0-indexed and have no gaps
 		a.forEach( function( el, idx ) {
 			el.setAttribute( 'data-fragment-index', idx );
 		} );

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
js/reveal.min.js


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů