allow reveal.js instances to be created with only options

This commit is contained in:
Hakim El Hattab
2020-04-15 10:30:49 +02:00
parent a55cd813be
commit d03fc04f61
3 changed files with 8 additions and 7 deletions

View File

@ -41,6 +41,12 @@ import {
*/
export default function( revealElement, options ) {
// Support initialization with only options
if( arguments.length === 1 ) {
options = arguments[0];
revealElement = document.querySelector( '.reveal' );
}
const Reveal = {};
// The reveal.js version
@ -117,11 +123,6 @@ export default function( revealElement, options ) {
*/
function initialize() {
if( !revealElement ) {
console.warn( 'reveal.js can not initialize without a valid .reveal element.' );
return;
}
// Cache references to key DOM elements
dom.wrapper = revealElement;
dom.slides = revealElement.querySelector( '.slides' );