Skip to content

Add info about calling remove() on nodes that have no parent node #40274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2025

Conversation

lionel-rowe
Copy link
Contributor

Description

Add info about calling remove() on nodes that have no parent node.

Also tightened up wording:

  • Element.remove doesn't always "remove the element from the DOM" (e.g. if the parent is already detached from the DOM)
  • CharacterData.remove doesn't "remove the text contained in the node", rather it removes the text node it from its parent, without altering its internal text data.

Motivation

Currently this info is missing.

Additional details

https://dom.spec.whatwg.org/#dom-childnode-remove

  1. If this’s parent is null, then return.
  2. Remove this.

Related issues and pull requests

N/A

@lionel-rowe lionel-rowe requested a review from a team as a code owner July 9, 2025 11:56
@lionel-rowe lionel-rowe requested review from wbamberg and removed request for a team July 9, 2025 11:56
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Jul 9, 2025
Copy link
Contributor

github-actions bot commented Jul 9, 2025

Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. Thanks for propagating it to all other pages!

@Josh-Cena Josh-Cena merged commit 04abc9f into mdn:main Jul 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants