Skip to content

Change element.parentNode.removeChild(element) to element.remove() #34071

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 4 commits into from
May 25, 2021

Conversation

GeoSot
Copy link
Member

@GeoSot GeoSot commented May 22, 2021

Change element.parentNode.removeChild(element) to element.remove()

@GeoSot GeoSot marked this pull request as ready for review May 22, 2021 00:10
@GeoSot GeoSot requested a review from a team as a code owner May 22, 2021 00:10
@XhmikosR XhmikosR changed the title Make removeElement helper Add removeElement helper May 22, 2021
@alpadev
Copy link
Contributor

alpadev commented May 22, 2021

Hm instead of using parentNode.removeChild() what if we just use element.remove()? This wouldn't throw if a parent doesn't exist, but serves the same functionality.

@XhmikosR
Copy link
Member

XhmikosR commented May 22, 2021

I actually planned to switch to modern APIs but never got to finish the branch and I can't find it right now.

bootstrap/.eslintrc.json

Lines 51 to 53 in b39b665

"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-dataset": "off",
"unicorn/prefer-dom-node-remove": "off",

And so on. :) I'd leave this for a separate PR, though.

@GeoSot GeoSot force-pushed the gs-add-remove-element-helper branch 2 times, most recently from efc5a90 to 1fc3957 Compare May 24, 2021 14:42
GeoSot added 3 commits May 25, 2021 14:34

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@GeoSot GeoSot force-pushed the gs-add-remove-element-helper branch from 1fc3957 to e8d2e64 Compare May 25, 2021 11:50
@GeoSot GeoSot changed the title Add removeElement helper Change element.remove() method May 25, 2021
@XhmikosR XhmikosR changed the title Change element.remove() method Change element.parentNode.removeChild(element) to element.remove() May 25, 2021
@XhmikosR XhmikosR merged commit 544d9ac into main May 25, 2021
@XhmikosR XhmikosR deleted the gs-add-remove-element-helper branch May 25, 2021 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants