From 8ac3383bee936aaf4939bf8d4cb30d5998ceff2b Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 16 Nov 2018 10:39:43 +0100 Subject: add getRevealElement API method --- js/reveal.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index f6f7903..637ea63 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -5683,6 +5683,11 @@ return query; }, + // Returns the top-level DOM element + getRevealElement: function() { + return dom.wrapper || document.querySelector( '.reveal' ); + }, + // Returns true if we're currently on the first slide isFirstSlide: function() { return ( indexh === 0 && indexv === 0 ); @@ -5724,12 +5729,12 @@ // Forward event binding to the reveal DOM element addEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { - ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture ); + Reveal.getRevealElement().addEventListener( type, listener, useCapture ); } }, removeEventListener: function( type, listener, useCapture ) { if( 'addEventListener' in window ) { - ( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture ); + Reveal.getRevealElement().removeEventListener( type, listener, useCapture ); } }, -- cgit v1.2.3