Bugfix with document as a selector in selectElements()