Don't bubble by default

semantics-font
Svein-Tore Griff With 2015-03-22 20:37:10 +01:00
parent 9a204b3d8f
commit 6b3e550a48
1 changed files with 4 additions and 3 deletions

View File

@ -8,12 +8,12 @@ var H5P = H5P || {};
H5P.Event = function(type, data, extras) {
this.type = type;
this.data = data;
var bubbles = true;
var bubbles = false;
if (extras === undefined) {
extras = {};
}
if (extras.bubbles === false) {
bubbles = false;
if (extras.bubbles === true) {
bubbles = true;
}
this.preventBubbling = function() {
bubbles = false;
@ -161,6 +161,7 @@ H5P.EventDispatcher = (function () {
for (var i = 0; i < triggers[event.type].length; i++) {
triggers[event.type][i].listener.call(triggers[event.type][i].thisArg, event);
}
// Bubble
if (event.getBubbles() && self.parent instanceof H5P.EventDispatcher && typeof self.parent.trigger === 'function') {
self.parent.trigger(event);
}