Fix: use window.document.