JSFiddle - React, Tailwind, and code Playground

HTML

<form id="form">
    <input name="parentNode" type="text" />
</form>

JavaScript

var node = form;
var looping = 0;

while (node = node.parentNode) {
  if (node === form) ++looping;
  if (looping > 10) {
    alert("This is really screwed up behaviour, what the hell!");
    break;
  }
}