JSFiddle - React, Tailwind, and code Playground

by CYRIL MOREAU

HTML

<!DOCTYPE html>
<html>
	<head>
		<title>DOM Leak Test</title>
	</head>
	<body>
		<div id="root">
			<h1>Root</h1>
			<ul>
				<li>
					<a href='' id='link1'>Link 1</a>
				</li>
				<li>
					Coucou
				</li>
			</ul>
		</div>
		<div id="utils">
			<button id="removeRoot">Remove Root</button>
		</div>
		
		<script>
			var rootRef = document.querySelector('#root');
			var linkRef = document.querySelector('#link1');

			document.querySelector('#removeRoot').onclick = function() {
				document.querySelector('body').removeChild(rootRef);
			};
		</script>
	</body>
</html>