Explorar o código

gracefully handle duplicate slide id's

Hakim El Hattab %!s(int64=6) %!d(string=hai) anos
pai
achega
397feab8b4
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      js/reveal.js

+ 4 - 1
js/reveal.js

@@ -3781,7 +3781,10 @@
 			}
 			catch ( error ) { }
 
-			if( element ) {
+			// Ensure that we're not already on a slide with the same name
+			var isSameNameAsCurrentSlide = currentSlide ? currentSlide.getAttribute( 'id' ) === name : false;
+
+			if( element && !isSameNameAsCurrentSlide ) {
 				// Find the position of the named slide and navigate to it
 				var indices = Reveal.getIndices( element );
 				slide( indices.h, indices.v );