Skip to content

Commit

Permalink
Clear body instead of document; use textContent instead of innerHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Apr 28, 2020
1 parent 39b2042 commit 0cc80fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions packages/react-art/src/ReactARTHostConfig.js
Expand Up @@ -427,12 +427,8 @@ export function unhideTextInstance(textInstance, text): void {
// Noop
}

export function clearContainer(container: Container): void {
// TODO This doesn't work for anything other than SVG.
// Is that okay?
while (container.lastChild != null) {
container.lastChild.eject();
}
export function clearContainer(container) {
// TODO Implement this
}

export function DEPRECATED_mountResponderInstance(
Expand Down
8 changes: 4 additions & 4 deletions packages/react-dom/src/client/ReactDOMHostConfig.js
Expand Up @@ -636,11 +636,11 @@ export function unhideTextInstance(

export function clearContainer(container: Container): void {
if (container.nodeType === ELEMENT_NODE) {
((container: any): Element).innerHTML = '';
((container: any): Element).textContent = '';
} else if (container.nodeType === DOCUMENT_NODE) {
const documentElement = ((container: any): Document).documentElement;
if (documentElement != null) {
documentElement.innerHTML = '';
const body = ((container: any): Document).body;
if (body != null) {
body.textContent = '';
}
}
}
Expand Down

0 comments on commit 0cc80fa

Please sign in to comment.