Refactored code duplication in FluentDOM\Query::next()/prev()