Skip to content

Modernize Element.prototype.empty using replaceChildren - #3417

Merged
Salvialf merged 1 commit into
developfrom
refactor/dom-empty-replacechildren
Jul 22, 2026
Merged

Modernize Element.prototype.empty using replaceChildren#3417
Salvialf merged 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
@Salvialf
Salvialf merged commit b97c08c into develop Jul 22, 2026
9 checks passed
@Salvialf
Salvialf deleted the refactor/dom-empty-replacechildren branch July 22, 2026 08:45
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.

3 participants