Add a guard to check if activeElement exists.

This commit is contained in:
Hyunje Alex Jun 2015-02-05 19:20:18 +00:00
parent b5d0958e82
commit 81dd8e9eb0

View File

@ -50,6 +50,7 @@ function bindKeyboardHandler(element, i) {
} }
var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement; var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
if (activeElement) {
// go deeper if element is a webcomponent // go deeper if element is a webcomponent
while (activeElement.shadowRoot) { while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement; activeElement = activeElement.shadowRoot.activeElement;
@ -57,6 +58,7 @@ function bindKeyboardHandler(element, i) {
if (h.isEditable(activeElement)) { if (h.isEditable(activeElement)) {
return; return;
} }
}
var deltaX = 0; var deltaX = 0;
var deltaY = 0; var deltaY = 0;