{"ScriptPreparationCode":"function isInDOM1(oHTMLElement) { \r\n if (oHTMLElement === document.body || oHTMLElement === document ) {\r\n return true;\r\n } else {\r\n try {\r\n return document.body.contains(oHTMLElement);\r\n } catch(ex) {\r\n // Sometimes in Firefox element is anonymous div around input.\r\n // Throws error \u0022TypeError: Argument 1 of Node.contains does not implement interface Node\u0022\r\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=208427\r\n return false;\r\n }\r\n }\r\n}\r\n\r\nfunction isInDOM2(oHTMLElement) { \r\n var root = oHTMLElement.ownerDocument; \r\n if (!root) { return false; }\r\n \r\n if ( oHTMLElement.ownerDocument.documentElement === document.documentElement ){ return true; }\r\n\r\n return false;\r\n}\r\n\r\nfunction isInDOM3(oHTMLElement) {\r\n var node = oHTMLElement;\r\n var documentRoot = document.body.getRootNode();\r\n while (node.parentNode !== documentRoot \u0026\u0026 node.parentNode !== undefined \u0026\u0026 node.parentNode !== null)\r\n node = node.parentNode;\r\n \r\n return node.parentNode === documentRoot;\r\n}\r\n\r\nvar div = document.getElementById(\u0027test-div\u0027);","TestCases":[{"Name":"isInDOM1","Code":"isInDOM1(div);","IsDeferred":false},{"Name":"isInDOM2","Code":"isInDOM2(div);","IsDeferred":false},{"Name":"isInDOM3","Code":"isInDOM3(div);","IsDeferred":false}]}