JSFiddle - React, Tailwind, and code Playground

HTML

<style> .aa { color: red }</style>
<button id="btn">POPUP</button>

JavaScript

btn.onclick = function() {
    var win = window.open();
    var raw_fn = win.Element.prototype.setAttribute;
    
    win.close();
    
    setTimeout(function() {
    console.log(raw_fn);
    raw_fn.call(btn, 'class', 'aa');
    }, 1000);
};