Partial fix for illegal invocation; window.document.querySelector still fails