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,12 +50,14 @@ function bindKeyboardHandler(element, i) {
}
var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
// go deeper if element is a webcomponent
while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
if (h.isEditable(activeElement)) {
return;
if (activeElement) {
// go deeper if element is a webcomponent
while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
if (h.isEditable(activeElement)) {
return;
}
}
var deltaX = 0;