additional cleanup when destroying #1145
parent
1e0cbe6779
commit
5e12c6aeb7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -394,4 +394,10 @@ export default class Backgrounds {
|
|||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.element.remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,12 @@ export default class Focus {
|
|||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.Reveal.getRevealElement().classList.remove( 'focused' );
|
||||
|
||||
}
|
||||
|
||||
onRevealPointerDown( event ) {
|
||||
|
||||
this.focus();
|
||||
|
|
|
@ -111,4 +111,10 @@ export default class Notes {
|
|||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.element.remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -101,5 +101,10 @@ export default class Progress {
|
|||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.element.remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -123,4 +123,10 @@ export default class SlideNumber {
|
|||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.element.remove();
|
||||
|
||||
}
|
||||
|
||||
}
|
30
js/reveal.js
30
js/reveal.js
|
@ -563,9 +563,14 @@ export default function( revealElement, options ) {
|
|||
disablePreviewLinks();
|
||||
|
||||
// Destroy controllers
|
||||
notes.destroy();
|
||||
focus.destroy();
|
||||
plugins.destroy();
|
||||
pointer.destroy();
|
||||
controls.destroy();
|
||||
progress.destroy();
|
||||
backgrounds.destroy();
|
||||
slideNumber.destroy();
|
||||
|
||||
// Remove event listeners
|
||||
document.removeEventListener( 'fullscreenchange', onFullscreenChange );
|
||||
|
@ -575,12 +580,35 @@ export default function( revealElement, options ) {
|
|||
window.removeEventListener( 'load', layout, false );
|
||||
|
||||
// Undo DOM changes
|
||||
dom.viewport.classList.remove( 'reveal-viewport' );
|
||||
if( dom.pauseOverlay ) dom.pauseOverlay.remove();
|
||||
if( dom.statusElement ) dom.statusElement.remove();
|
||||
|
||||
document.documentElement.classList.remove( 'reveal-full-page' );
|
||||
|
||||
dom.wrapper.classList.remove( 'ready', 'center', 'has-horizontal-slides', 'has-vertical-slides' );
|
||||
dom.wrapper.removeAttribute( 'data-transition-speed' );
|
||||
dom.wrapper.removeAttribute( 'data-background-transition' );
|
||||
|
||||
dom.viewport.classList.remove( 'reveal-viewport' );
|
||||
dom.viewport.style.removeProperty( '--slide-width' );
|
||||
dom.viewport.style.removeProperty( '--slide-height' );
|
||||
|
||||
dom.slides.style.removeProperty( 'width' );
|
||||
dom.slides.style.removeProperty( 'height' );
|
||||
dom.slides.style.removeProperty( 'zoom' );
|
||||
dom.slides.style.removeProperty( 'left' );
|
||||
dom.slides.style.removeProperty( 'top' );
|
||||
dom.slides.style.removeProperty( 'bottom' );
|
||||
dom.slides.style.removeProperty( 'right' );
|
||||
dom.slides.style.removeProperty( 'transform' );
|
||||
|
||||
Array.from( dom.wrapper.querySelectorAll( SLIDES_SELECTOR ) ).forEach( slide => {
|
||||
slide.style.removeProperty( 'display' );
|
||||
slide.style.removeProperty( 'top' );
|
||||
slide.removeAttribute( 'hidden' );
|
||||
slide.removeAttribute( 'aria-hidden' );
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue