Skip to content

Commit

Permalink
Add checks to remove child
Browse files Browse the repository at this point in the history
  • Loading branch information
outercloudstudio committed Oct 21, 2023
1 parent f9b9c2e commit 2ccd25d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/Editors/IframeTab/IframeTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export class IframeTab extends Tab {
this.iframe.style.display = 'none'
}
onDestroy() {
getFullScreenElement()?.removeChild(this.iframe)
if (getFullScreenElement()?.contains(this.iframe))
getFullScreenElement()?.removeChild(this.iframe)

this.api.dispose()
}

Expand Down
7 changes: 5 additions & 2 deletions src/components/FileSystem/Polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ if (isUnsupportedBrowser() || typeof window.showOpenFilePicker !== 'function') {
isLocked = true
const files = [...(input.files ?? [])]

document.body.removeChild(input)
if (document.body.contains(input))
document.body.removeChild(input)

resolve(
// @ts-ignore
await Promise.all(
Expand All @@ -110,7 +112,8 @@ if (isUnsupportedBrowser() || typeof window.showOpenFilePicker !== 'function') {
if (isLocked) return

reject('User aborted selecting file')
document.body.removeChild(input)
if (document.body.contains(input))
document.body.removeChild(input)
}, 300)
},
{ once: true }
Expand Down

0 comments on commit 2ccd25d

Please sign in to comment.