JSFiddle - React, Tailwind, and code Playground
JavaScript
var parent = document.createElement("div");
document.body.appendChild(parent);
var movingChild = document.createElement("a");
movingChild.href = "http://example.com";
movingChild.innerHTML = "LINK";
parent.appendChild(movingChild);
movingChild.focus();
var placeholderChild = document.createElement("div");
placeholderChild.innerHTML = "HOLDER";
parent.appendChild(placeholderChild);
var listener = function() {
console.log("blur");
movingChild.removeEventListener(listener);
document.body.removeChild(parent);
movingChild.appendChild(parent);
};
movingChild.addEventListener("blur", listener);
parent.appendChild(movingChild);