Skip to content

Commit

Permalink
fixes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweck committed Jul 12, 2014
1 parent 18a0fcc commit 472d861
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions lib/Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,57 @@ define(['i18n/Strings', 'keymaster', 'storage/Settings'], function(Strings, key,
},
dispatch: function(target, e)
{
//$(window).trigger(e);

//THIS FUNCTION NOT REACHED WHEN e.stopPropagation(); INVOKED IN IFRAME's HTML

if (e.cancelBubble)
{
//WHEN e.cancelBubble = true IN IFRAME's HTML's own event callback
return;
}

if (e.defaultPrevented)
{
//WHEN e.preventDefault() INVOKED IN IFRAME's HTML
return;
}

if (typeof e.returnValue !== "undefined" && !e.returnValue)
{
//WHEN e.returnValue = false IN IFRAME's HTML's own event callback
return;
}

var source = e.srcElement || e.target;
if (source)
{
var parent = source;
while (parent)
{
var name = parent.nodeName;
if (name === "input" || name === "textarea")
{
return;
}

if (parent.getAttribute)
{
var ce = parent.getAttribute("contenteditable");
if (ce === "true" || ce === "contenteditable")
{
return;
}
}

if (parent.classList && parent.classList.contains("keyboard-input"))
{
return;
}

parent = parent.parentNode;
}
}


// //var newE = jQuery.extend(true, {}, e);// deep copy
// var newE = $.extend($.Event(e.type), {}, e);
//
Expand Down Expand Up @@ -299,6 +348,7 @@ define(['i18n/Strings', 'keymaster', 'storage/Settings'], function(Strings, key,
"key": e.key ? e.key : e.keyCode // case-insensitive
});

//$(target).trigger(e);
target.dispatchEvent(ev);
},
scope: function(scope)
Expand Down

0 comments on commit 472d861

Please sign in to comment.