class Capybara::Queries::SiblingQuery

def resolve_for(node, exact = nil)

Other tags:
    Api: - private
def resolve_for(node, exact = nil)
  @sibling_node = node
  node.synchronize do
    scope = node.respond_to?(:session) ? node.session.current_scope : node.find(:xpath, '/*')
    match_results = super(scope, exact)
    siblings = node.find_xpath((XPath.preceding_sibling + XPath.following_sibling).to_s)
                   .map(&method(:to_element))
                   .select { |el| match_results.include?(el) }
    Capybara::Result.new(ordered_results(siblings), self)
  end
end