aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2017-03-14 09:06:39 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2017-03-14 09:06:39 +0100
commit7e6fb9ec87f10f4cc379240fc5824925ebf2bff3 (patch)
tree7749c4c5bb62ca07cbb5ce8c0f95cab8fa0d8e39
parentb143e5976bd3dbc5445a27052a93ab6f060b361b (diff)
downloadfreenode-live-2017-presentation-7e6fb9ec87f10f4cc379240fc5824925ebf2bff3.tar
freenode-live-2017-presentation-7e6fb9ec87f10f4cc379240fc5824925ebf2bff3.tar.gz
avoid npe on iframe postMessage
-rw-r--r--js/reveal.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 65560a6..3267465 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3377,20 +3377,20 @@
// Generic postMessage API for non-lazy loaded iframes
toArray( element.querySelectorAll( 'iframe' ) ).forEach( function( el ) {
- el.contentWindow.postMessage( 'slide:stop', '*' );
+ if( el.contentWindow ) el.contentWindow.postMessage( 'slide:stop', '*' );
el.removeEventListener( 'load', startEmbeddedIframe );
});
// YouTube postMessage API
toArray( element.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
- if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) {
+ if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' );
}
});
// Vimeo postMessage API
toArray( element.querySelectorAll( 'iframe[src*="player.vimeo.com/"]' ) ).forEach( function( el ) {
- if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) {
+ if( !el.hasAttribute( 'data-ignore' ) && el.contentWindow && typeof el.contentWindow.postMessage === 'function' ) {
el.contentWindow.postMessage( '{"method":"pause"}', '*' );
}
});