modified the getWindow methods for Document and Element to reflect the latest changes