scope all query selection to .reveal

This commit is contained in:
Hakim El Hattab 2020-03-07 14:12:28 +01:00
parent dd852851ef
commit f968927bff
2 changed files with 14 additions and 12 deletions

2
dist/reveal.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -462,12 +462,12 @@ export default function( revealElement, options ) {
dom.wrapper.setAttribute( 'role', 'application' ); dom.wrapper.setAttribute( 'role', 'application' );
// There can be multiple instances of controls throughout the page // There can be multiple instances of controls throughout the page
dom.controlsLeft = toArray( document.querySelectorAll( '.navigate-left' ) ); dom.controlsLeft = toArray( dom.wrapper.querySelectorAll( '.navigate-left' ) );
dom.controlsRight = toArray( document.querySelectorAll( '.navigate-right' ) ); dom.controlsRight = toArray( dom.wrapper.querySelectorAll( '.navigate-right' ) );
dom.controlsUp = toArray( document.querySelectorAll( '.navigate-up' ) ); dom.controlsUp = toArray( dom.wrapper.querySelectorAll( '.navigate-up' ) );
dom.controlsDown = toArray( document.querySelectorAll( '.navigate-down' ) ); dom.controlsDown = toArray( dom.wrapper.querySelectorAll( '.navigate-down' ) );
dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) ); dom.controlsPrev = toArray( dom.wrapper.querySelectorAll( '.navigate-prev' ) );
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); dom.controlsNext = toArray( dom.wrapper.querySelectorAll( '.navigate-next' ) );
// The left, right and down arrows in the standard reveal.js controls // The left, right and down arrows in the standard reveal.js controls
dom.controlsRightArrow = dom.controls.querySelector( '.navigate-right' ); dom.controlsRightArrow = dom.controls.querySelector( '.navigate-right' );
@ -486,7 +486,7 @@ export default function( revealElement, options ) {
*/ */
function createStatusDiv() { function createStatusDiv() {
let statusDiv = document.getElementById( 'aria-status-div' ); let statusDiv = dom.wrapper.querySelector( '.aria-status' );
if( !statusDiv ) { if( !statusDiv ) {
statusDiv = document.createElement( 'div' ); statusDiv = document.createElement( 'div' );
statusDiv.style.position = 'absolute'; statusDiv.style.position = 'absolute';
@ -494,7 +494,7 @@ export default function( revealElement, options ) {
statusDiv.style.width = '1px'; statusDiv.style.width = '1px';
statusDiv.style.overflow = 'hidden'; statusDiv.style.overflow = 'hidden';
statusDiv.style.clip = 'rect( 1px, 1px, 1px, 1px )'; statusDiv.style.clip = 'rect( 1px, 1px, 1px, 1px )';
statusDiv.setAttribute( 'id', 'aria-status-div' ); statusDiv.classList.add( 'aria-status' );
statusDiv.setAttribute( 'aria-live', 'polite' ); statusDiv.setAttribute( 'aria-live', 'polite' );
statusDiv.setAttribute( 'aria-atomic','true' ); statusDiv.setAttribute( 'aria-atomic','true' );
dom.wrapper.appendChild( statusDiv ); dom.wrapper.appendChild( statusDiv );
@ -531,7 +531,9 @@ export default function( revealElement, options ) {
} }
return text.trim(); text = text.trim();
return text === '' ? '' : text + ' ';
} }
@ -1474,7 +1476,7 @@ export default function( revealElement, options ) {
*/ */
function enablePreviewLinks( selector = 'a' ) { function enablePreviewLinks( selector = 'a' ) {
toArray( document.querySelectorAll( selector ) ).forEach( element => { toArray( dom.wrapper.querySelectorAll( selector ) ).forEach( element => {
if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
element.addEventListener( 'click', onPreviewLinkClicked, false ); element.addEventListener( 'click', onPreviewLinkClicked, false );
} }
@ -1487,7 +1489,7 @@ export default function( revealElement, options ) {
*/ */
function disablePreviewLinks( selector = 'a' ) { function disablePreviewLinks( selector = 'a' ) {
toArray( document.querySelectorAll( selector ) ).forEach( element => { toArray( dom.wrapper.querySelectorAll( selector ) ).forEach( element => {
if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) { if( /^(http|www)/gi.test( element.getAttribute( 'href' ) ) ) {
element.removeEventListener( 'click', onPreviewLinkClicked, false ); element.removeEventListener( 'click', onPreviewLinkClicked, false );
} }