From 1ad8bd0a52bc8f6f9d878791b94117d6f87595ac Mon Sep 17 00:00:00 2001 From: Mark Aron Szulyovszky Date: Thu, 12 Oct 2017 14:24:45 +0200 Subject: [PATCH] Revert "refactored Common.isElement" This reverts commit 295cffeacfaf01af83bd19ea3710cf58e50843ed. --- src/core/Common.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/Common.js b/src/core/Common.js index 350e7518..6a36c391 100644 --- a/src/core/Common.js +++ b/src/core/Common.js @@ -177,7 +177,15 @@ module.exports = Common; * @return {boolean} True if the object is a HTMLElement, otherwise false */ Common.isElement = function(obj) { + // http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object + try { return obj instanceof HTMLElement; + } + catch(e){ + return (typeof obj==="object") && + (obj.nodeType===1) && (typeof obj.style === "object") && + (typeof obj.ownerDocument ==="object"); + } }; /**