Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4272310
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:33:37+00:00 2026-05-21T07:33:37+00:00

When an element is removed from the DOM using removeChild() , the reference to

  • 0

When an element is removed from the DOM using removeChild(), the reference to the element still exist but the element is no more in the DOM.
How to know if an HTML element (or its parents) is still attached to a document ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:33:38+00:00Added an answer on May 21, 2026 at 7:33 am

    From http://code.google.com/p/doctype-mirror/wiki/ArticleNodeContains:

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title></title>
            <script>
                function contains(parent, descendant) {
                    return parent == descendant || Boolean(parent.compareDocumentPosition(descendant) & 16);
                }
                window.addEventListener("DOMContentLoaded", function() {
                    var p = document.getElementById("test");
                    //document.body.removeChild(p);
                    alert(contains(document, p));
                }, false);
            </script>
        </head>
        <body>
            <p id="test">test</p>
        </body>
    </html>
    

    I only tested in Opera though.

    There are alternatives on that page too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to remove an element from the DOM tree:
I am trying to delete the child element in the dom from its parent
If I remove an element from the DOM which has event handlers attached, and
How do I remove an element from an array when I know the element's
i am not able to remove elements from the dom. i am using firfox.
I want to remove empty paragraphs from an HTML document using simple_html_dom.php . I
I have an event handler that will remove an element from a list of
I'm trying to remove a class attribute from an element and add the class
How can I remove the xmlns:... namespace information from each XML element in C#?
In theory, is it more efficient to remove elements from an ArrayList or a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.