From f45a3ec3f3a886515f78ff4f1a256bca22c4329e Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 5 Apr 2019 07:34:14 -0700 Subject: [PATCH] Make it safe to reparent the #webamp node For now users can't control where Webamp inserts itself into the DOM. We want to add that as and option. In the mean time, we can enable users to hack it. For example, https://github.com/ShizukuIchi/winXP wants to be able to keep Webamp in a div in order to control how it gets layerd with other apps. --- js/components/App.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/components/App.js b/js/components/App.js index 7af440a0..4a5edaea 100644 --- a/js/components/App.js +++ b/js/components/App.js @@ -42,7 +42,10 @@ class App extends React.Component { componentWillUnmount() { window.removeEventListener("resize", this._handleWindowResize); - document.body.removeChild(this._webampNode); + const parentNode = this._webampNode.parentNode; + if (parentNode != null) { + parentNode.removeChild(this._webampNode); + } } componentDidMount() {