JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="userinput" cols="50" rows="10">
<img src="dummy" onerror="alert('owned');" onload="alert('still owned');" />
</textarea>
<br />
<button id="button">Inspect user input without inserting into DOM</button>
JavaScript
var userinput = document.getElementById("userinput"),
button = document.getElementById("button");
button.addEventListener("click", function () {
var content = userinput.value,
div = document.createElement("div");
console.log(content);
div.innerHTML = content; // browser will try fetching the resource specified in src attribute.
var imgs = div.getElementsByTagName("img");
for (var i = 0; i < imgs.length; i += 1) {
//delete imgs[i].src; // Even deleting the src attribute comes too late.
imgs[i].src = "http://jsfiddle.net/img/logo.png"; // browser will try fetching the resource at this new URL.
}
// div was never inserted into DOM!
});