Skip to content

Modernize Element.prototype.empty using replaceChildren#3417

Open
Salvialf wants to merge 1 commit into
developfrom
refactor/dom-empty-replacechildren
Open

Modernize Element.prototype.empty using replaceChildren#3417
Salvialf wants to merge 1 commit into
developfrom
refactor/dom-empty-replacechildren

Conversation

@Salvialf

@Salvialf Salvialf commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Replaces the manual while (this.firstChild) { this.removeChild(this.lastChild) } loop with the native replaceChildren() method.

This clears all children in a single DOM operation instead of one removeChild call per node, and is consistent with other modern DOM APIs already used in this file (closest, Array.from, optional chaining).

- Replaces the manual while/removeChild loop with the native replaceChildren() call
- Clears all children in a single DOM operation instead of one removeChild per node
@Salvialf Salvialf added the changelog-other Use to generate release notes label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-other Use to generate release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants