aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-05-20 08:14:48 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-05-20 08:14:55 +0200
commit8c9c0ab0a64f32e8aa567009a82bac57464f4f93 (patch)
tree55c4e756cfacb26a45c3188e3a4655d4e7b14048 /js
parentb558f742990f08659348146c2bf3527ed99d519f (diff)
downloadfosdem-2018-presentation-8c9c0ab0a64f32e8aa567009a82bac57464f4f93.tar
fosdem-2018-presentation-8c9c0ab0a64f32e8aa567009a82bac57464f4f93.tar.gz
validate named links according to html id spec #914
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js
index a1d9caa..6097eea 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2595,14 +2595,11 @@
if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) {
var element;
- try {
- // Find the slide with the specified name
+ // 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.querySelector( '#' + name );
}
- catch( e ) {
- // If the ID is an invalid selector a harmless SyntaxError
- // may be thrown here.
- }
if( element ) {
// Find the position of the named slide and navigate to it