JSFiddle - React, Tailwind, and code Playground

JavaScript

document.createElement = function(create) {
    return function() {
        var ret = create.apply(this, arguments);
        if (ret.tagName.toLowerCase() === "div") {
            ret.setAttribute("foo", "bar");
        }
        return ret;
    };
}(document.createElement)
    
    document.body.appendChild(document.createElement("div"));

alert(document.body.getElementsByTagName("div")[0].getAttribute("foo"));