Add a guard to check if activeElement exists.

This commit is contained in:
Hyunje Alex Jun
2015-02-05 19:18:35 +00:00
parent bd22fc0e58
commit 2fc41e7045
+9 -6
View File
@@ -470,12 +470,15 @@
} }
var activeElement = document.activeElement ? document.activeElement : ownerDocument.activeElement; var activeElement = document.activeElement ? document.activeElement : ownerDocument.activeElement;
// go deeper if element is a webcomponent
while (activeElement.shadowRoot) { if (activeElement) {
activeElement = activeElement.shadowRoot.activeElement; // go deeper if element is a webcomponent
} while (activeElement.shadowRoot) {
if ($(activeElement).is(":input,[contenteditable]")) { activeElement = activeElement.shadowRoot.activeElement;
return; }
if ($(activeElement).is(":input,[contenteditable]")) {
return;
}
} }
var deltaX = 0; var deltaX = 0;