Skip to content

Commit fa315b1

Browse files
authored
Check if hiddenTextarea is in current body
In situations where the document.body was replaced, the check if hiddenTextarea.parentNode === null would return false even if in fact the new document.body had no current hiddenTextarea, thus requiring a new one to be appended. The new logic checks if !document.body.contains(hiddenTextarea), which should account for the current document.body. See here for more details Andarist#292
1 parent 58c9807 commit fa315b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/calculateNodeHeight.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function calculateNodeHeight(
3333
forceHiddenStyles(hiddenTextarea);
3434
}
3535

36-
if (hiddenTextarea.parentNode === null) {
36+
if (!document.body.contains(hiddenTextarea)) {
3737
document.body.appendChild(hiddenTextarea);
3838
}
3939

0 commit comments

Comments
 (0)