B2G/gecko/browser/devtools/shared/LayoutHelpers.jsm
/**
   * Check if a node and its document are still alive
   * and attached to the window.
   *
   * @param aNode
   */
Check if a node and its document are still alive
and attached to the window.

@param aNode
Check if a node and its document are still alive and attached to the window . @param aNode
function LH_isNodeConnected(aNode)
  {
    try {
      let connected = (aNode.ownerDocument && aNode.ownerDocument.defaultView &&
                      !(aNode.compareDocumentPosition(aNode.ownerDocument.documentElement) &
                      aNode.DOCUMENT_POSITION_DISCONNECTED));
      return connected;
    } catch (e) {
      return false;
    }
  }
function LH_isNodeConnected ( aNode ) { try { let connected = ( aNode . ownerDocument && aNode . ownerDocument . defaultView && ! ( aNode . compareDocumentPosition ( aNode . ownerDocument . documentElement ) & aNode . DOCUMENT_POSITION_DISCONNECTED ) ) ; return connected ; } catch ( e ) { return false ; } }
Check if a node and its document are still alive
 and attached to the window.
Check if a node and its document are still alive and attached to the window .
// "can't access dead object" error