validate named links according to html id spec #914
parent
b558f74299
commit
8c9c0ab0a6
|
@ -2595,14 +2595,11 @@
|
||||||
if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) {
|
if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) {
|
||||||
var element;
|
var element;
|
||||||
|
|
||||||
try {
|
// Ensure the named link is a valid HTML ID attribute
|
||||||
// Find the slide with the specified name
|
if( /^[a-zA-Z][\w:.-]*$/.test( name ) ) {
|
||||||
|
// Find the slide with the specified ID
|
||||||
element = document.querySelector( '#' + name );
|
element = document.querySelector( '#' + name );
|
||||||
}
|
}
|
||||||
catch( e ) {
|
|
||||||
// If the ID is an invalid selector a harmless SyntaxError
|
|
||||||
// may be thrown here.
|
|
||||||
}
|
|
||||||
|
|
||||||
if( element ) {
|
if( element ) {
|
||||||
// Find the position of the named slide and navigate to it
|
// Find the position of the named slide and navigate to it
|
||||||
|
|
Loading…
Reference in New Issue