ソースを参照

Merge branch 'URI-encode-name-hash' of https://github.com/nnormand/reveal.js into dev

Hakim El Hattab 6 年 前
コミット
4cb0d52c73
1 ファイル変更6 行追加5 行削除
  1. 6 5
      js/reveal.js

+ 6 - 5
js/reveal.js

@@ -3776,10 +3776,11 @@
 			var element;
 
 			// Ensure the named link is a valid HTML ID attribute
-			if( /^[a-zA-Z][\w:.-]*$/.test( name ) ) {
-				// Find the slide with the specified ID
-				element = document.getElementById( name );
-			}
+			try {
+				element = document.getElementById( decodeURIComponent( name ) );
+                        }
+			catch (e) {
+                        }
 
 			if( element ) {
 				// Find the position of the named slide and navigate to it
@@ -3834,7 +3835,7 @@
 				// Attempt to create a named link based on the slide's ID
 				var id = currentSlide.getAttribute( 'id' );
 				if( id ) {
-					id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' );
+					id = encodeURIComponent( id );
 				}
 
 				var indexf;