From 46dd9dd817a7e362afb099d3fcc6e9a97c1ee4d3 Mon Sep 17 00:00:00 2001
From: Eric Weikl <eric.weikl@gmx.net>
Date: Tue, 18 Jun 2013 18:33:03 +0200
Subject: [PATCH] Create a single fragment event per fragment-index

For backward-compatibility, add a new 'fragments' property to the
fragmentshown and fragmenthidden events. The 'fragment' property still
returns the first fragment.
---
 js/reveal.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/js/reveal.js b/js/reveal.js
index 70c782c..074fd9d 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1916,11 +1916,11 @@ var Reveal = (function(){
 
 				toArray( fragments ).forEach( function( element ) {
 					element.classList.add( 'visible' );
-
-					// Notify subscribers of the change
-					dispatchEvent( 'fragmentshown', { fragment: element } );
 				} );
 
+				// Notify subscribers of the change
+				dispatchEvent( 'fragmentshown', { fragment: fragments[0], fragments: fragments } );
+
 				updateControls();
 				return true;
 			}
@@ -1950,11 +1950,11 @@ var Reveal = (function(){
 
 				toArray( fragments ).forEach( function( f ) {
 					f.classList.remove( 'visible' );
-
-					// Notify subscribers of the change
-					dispatchEvent( 'fragmenthidden', { fragment: f } );
 				} );
 
+				// Notify subscribers of the change
+				dispatchEvent( 'fragmenthidden', { fragment: fragments[0], fragments: fragments } );
+
 				updateControls();
 				return true;
 			}
-- 
GitLab