additional cleanup when destroying #1145
This commit is contained in:
parent
1e0cbe6779
commit
5e12c6aeb7
2
dist/reveal.esm.js
vendored
2
dist/reveal.esm.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.esm.js.map
vendored
2
dist/reveal.esm.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js.map
vendored
2
dist/reveal.js.map
vendored
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
Block a user