Avoid using deprecated document.popupNode